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

浙公网安备 33010602011771号