K
kwl
Can someone point me in the right direction, I can get this to work
when I copy the entire row but I only want to copy a single cell to a
cell on the main page. Sheet1 is used as a part list with prices.
Sub copyData()
Dim rng1 As Range, rng2 As Range
Dim cell As Range, rw As Long
Dim sh As Worksheet
With Worksheets("Sheet1")
Set rng1 = .Range(.Cells(1, "A"), .Cells(.Rows.Count,
"A").End(xlUp))
End With
With Worksheets("node 1&2")
Set rng2 = .Range(.Cells(1, "B"), .Cells(.Rows.Count,
"B").End(xlUp))
End With
rw = 1
For Each cell In rng2
If cell.Value = rng1.Cells(Rows.Count, "A").Value Then
rng1.Cells(Rows.Count, "E").Copy Destination:=rng2.Cells(Rows.Count,
"E")
rw = rw + 1
End If
Next
End Sub
when I copy the entire row but I only want to copy a single cell to a
cell on the main page. Sheet1 is used as a part list with prices.
Sub copyData()
Dim rng1 As Range, rng2 As Range
Dim cell As Range, rw As Long
Dim sh As Worksheet
With Worksheets("Sheet1")
Set rng1 = .Range(.Cells(1, "A"), .Cells(.Rows.Count,
"A").End(xlUp))
End With
With Worksheets("node 1&2")
Set rng2 = .Range(.Cells(1, "B"), .Cells(.Rows.Count,
"B").End(xlUp))
End With
rw = 1
For Each cell In rng2
If cell.Value = rng1.Cells(Rows.Count, "A").Value Then
rng1.Cells(Rows.Count, "E").Copy Destination:=rng2.Cells(Rows.Count,
"E")
rw = rw + 1
End If
Next
End Sub