将NULL列的数据行复制到同一工作表中的另一个范围

选择NULL行,然后复制 我正在Win 7上使用EXCEL 2010 vba。

我需要在一列中findNULL的数据行。 并将它们复制到同一工作表中的另一个范围。

Option Explicit Sub find_null_entries() Dim ActSheet As Worksheet Dim myRange As Range Dim null_counter As Integer Dim res_rng As Range null_counter = 0 Set ActSheet = ActiveSheet Set myRange = Selection Range("D1").Value = "NULL rows" For Each c In myRange If c.Value Is "NULL" Then null_count = null_count + 1 res_rng // copy the data entry to another range in the same worksheet, eg column D End If Next c End Sub 

例如

  item value person1 NULL // find this row and then copy the **WHOLE** row to another range in the same worksheet person2 18 

UPDATE

  copy "person1 NULL" to another two columns example: from A2:B2 to D2:E2 

我有5000行的数据,但也许有100行“NULL”。 我需要find他们,并复制toehr列。

任何帮助,将不胜感激 。

UPD:

 Sub find_null_entries() Dim myRange As Range Dim c As Range Dim null_counter As Long Set myRange = Intersect(Selection, ActiveSheet.UsedRange) Range("D1").Value = "NULL rows" For Each c In myRange If c.Value Like "*NULL*" Then null_counter = null_counter + 1 Range("D1").Offset(null_counter).Resize(, 2).Value = c.Offset(, -1).Resize(, 2).Value End If Next c End Sub