xcelnovice
Board Regular
- Joined
- Dec 31, 2011
- Messages
- 81
Hi have the below code & want to manipulate it to copy down to the end of my data. Right now it goes down to Q3500 but I’d like it to be dynamic. Also if the structure of my code is funky m, mainly the last With statement I’m open to suggestions.
Code:
Sub Test()
Dim startRow As Long
Dim lastRow As Long
startRow = 2
lastRow = Cells(Cells.Rows.Count, 1).End(xlUp).Row
ThisWorkbook.Worksheets("Page1_1").Cells.Copy
With ThisWorkbook.Worksheets("DATA")
.Range("A1").PasteSpecial Paste:=xlPasteValues
With .Range("A4:C" & lastRow)
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
End With
End With
With ThisWorkbook.Worksheets (“DATA”)
.Range(“Q4”).FormulaR1C1 = “SUM(RC[-12]:RC[-1])”
End With
End Sub