paulked
04-18-2012, 11:00 PM
Hi there
I've been trying to select multiple Cells to copy to another sheet but can't get the code to work. I have this that works:
Sub PopulateInvoice()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rd As Range
Dim cnt As Integer
Dim rw As Integer
Set ws1 = Worksheets("Artisan Foods price list")
Set ws2 = Worksheets("Invoice")
cnt = 12
For rw = 20 To 131
Set rd = ws1.Cells(rw, 12)
If rd.Value > 0 And rd.Value < 21 Then
ws1.Cells(rw, 2).Copy
ws2.Cells(cnt, 2).PasteSpecial Paste:=xlPasteValues
cnt = cnt + 1
End If
Next
End Sub
But I would like to
ws1.Cells((rw, 2), (rw, 3), (rw, 6), (rw, 12), (rw, 13)).copy
How do I do that?
Many thanks
I've been trying to select multiple Cells to copy to another sheet but can't get the code to work. I have this that works:
Sub PopulateInvoice()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rd As Range
Dim cnt As Integer
Dim rw As Integer
Set ws1 = Worksheets("Artisan Foods price list")
Set ws2 = Worksheets("Invoice")
cnt = 12
For rw = 20 To 131
Set rd = ws1.Cells(rw, 12)
If rd.Value > 0 And rd.Value < 21 Then
ws1.Cells(rw, 2).Copy
ws2.Cells(cnt, 2).PasteSpecial Paste:=xlPasteValues
cnt = cnt + 1
End If
Next
End Sub
But I would like to
ws1.Cells((rw, 2), (rw, 3), (rw, 6), (rw, 12), (rw, 13)).copy
How do I do that?
Many thanks