Excel Todo列表

时间:2015-11-19 15:04:31

标签: excel vba excel-vba

我有一个用作任务列表的Excel文件。它看起来像这样: Excel Image

我希望它设置为当我将状态切换为“完成”时,该条目将被移除到表格并显示在包含所有其他“完成”条目的第二张纸上。

我已经成功使用宏来自动更新隐藏表中条目的过滤器,但不知道如何将行复制到新工作表上。

1 个答案:

答案 0 :(得分:-1)

你尝试这样的事情怎么样?我在一年前遇到过的东西并将其改为enter image description here

Sub MoveRow(DL As Long)
Dim A As Worksheet

Dim d As Worksheet
Dim P As Worksheet

Dim From As String
Dim To As String
Dim OK As String
Dim S As String

Dim F As Long
Dim T As Long
Dim AL As Long
Dim FL As Long

Dim x As Integer

'find sheet 
Set P = Worksheets("YourSheet") 'i Call this sheet "parameters" where I put my defined parameters. This sheet defines all actions (see pic)
S = P.Cells(4, 2)
Set d = Worksheets(S)
S = P.Cells(5, 2)
Set A = Worksheets(S)

' cloumn from/T0
From = P.Cells(2, 2)
To = P.Cells(3, 2)
F = d.Range(from & "1").Column
T = d.Range(To & "1").Column
AL = A.UsedRange.Rows.Count + 1

For x = F To T
A.Cells(AL, x) = d.Cells(DL, x)
Next

'Delete row
d.Range(from & DL & ":" & Til & DL).Select
Selection.Delete Shift:=xlUp
d.Range(from & DL).Select
End Sub