I'm having an issue and I'm hoping someone can help. I have code which will copy an entire row from "Sheet2" if the value in the cell in column Q is >0 and will paste it in "Sheet6". I do not need the entire row to be copied. I need the cells in columns B, C, D, E, F, G, H, Q and U to be copied from "Sheet2" an pasted into "Sheet6". Can someone show me the code to copy and paste the range of cells, rather than the entire row? Here is the code I am using, which works for copying the entire row.
Sub copyrows3()
Dim rng As Range
Dim cell As Range
Dim lr As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheet2
Set ws2 = Sheet6
lr = ws1.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = ws1.Range("q1:q" & lr)
For Each cell In rng
If cell.Value > 0 Then
cell.EntireRow.Copy
ws2.Select
If ws2.Range("A1").Value = "" Then
ws2.Range("a1").PasteSpecial xlPasteValues
Else
Cells((Cells(Rows.Count, "a").End(xlUp).Row) + 1, "a").PasteSpecial xlPasteValues
End If
End If
Next cell
Application.CutCopyMode = False
Range("A1").Select
End Sub
Thanks in advance for any help you can provide.
Sub copyrows3()
Dim rng As Range
Dim cell As Range
Dim lr As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheet2
Set ws2 = Sheet6
lr = ws1.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = ws1.Range("q1:q" & lr)
For Each cell In rng
If cell.Value > 0 Then
cell.EntireRow.Copy
ws2.Select
If ws2.Range("A1").Value = "" Then
ws2.Range("a1").PasteSpecial xlPasteValues
Else
Cells((Cells(Rows.Count, "a").End(xlUp).Row) + 1, "a").PasteSpecial xlPasteValues
End If
End If
Next cell
Application.CutCopyMode = False
Range("A1").Select
End Sub
Thanks in advance for any help you can provide.