excel vba code: copy value and loop through table

'In this example I am Copying the Data from Sheet1 (Source) to Sheet2 (Destination)
Sub sbCopyRangeToAnotherSheet()


'Method 1
Sheets("book1").Range("A1:B1").Copy Destination:=Sheets("book2").Range("A1:B1")

End Sub

'loop throug table by row

Sub sbCopyToTable()

For i = 1 To Range("tank1_list_table1").Rows.Count
   If (Range("tank1_list_table1[set]")(i) = "1" And Range("tank1_list_table1[location]")(i) = "28") Then
   MsgBox ("found it")
   End If
Next i

End Sub

  

posted @ 2021-07-04 18:39  锦衣昼行  阅读(114)  评论(0)    收藏  举报