Hello. I use this code to copy data from one sheet to another. My problem is that it pastes the data at the first empty cell in column C. What I want is to install the paste starting from cell C 10, regardless of whether there is data before the tenth row or not.
VBA Code:
Sub test()
Dim Sh1 As Worksheet, Sh2 As Worksheet
Set Sh1 = Sheets("Sheet1"): Set Sh2 = Sheets("Sheet2")
Dim j&, i&, LASTROW&, X As String
Dim Rng As Range
X = Sh2.[B4]
LASTROW = Sh1.Cells(Rows.Count, 12).End(xlUp).Row
For j = 5 To LASTROW
If UCase(Sh1.Cells(j, 12)) = X Then
Set Rng = Sh1.Range(Sh1.Cells(j, 3), Sh1.Cells(j, 30))
' You must paste in row 10 in column C
Sh2.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Resize(1, 28).Value = Rng.Value
End If
Next j
End Sub