Hi all,
I am trying to use a 'find function' to find a date in row 5, and under that date enter a formula into all cells down to the lastrow. Here is my code below,
ThisWorkbook.Activate
Sheets("MT4 Client P&L").Select
Rows("5:5").Select
Selection.Find(What:=Sheets("Imports").Range("a1"), After:=ActiveCell, LookIn:=xlFormulas _
, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.Formula = _
"=IFERROR(VLOOKUP(A6,'MT4 P&L Data'!$A:$F,6,FALSE),0)"
Dim Lastrow As Integer
Lastrow = ActiveSheet.UsedRange.Rows.Count
Range("g6:g6").Select
Selection.AutoFill Destination:=Range("g6:g" & Lastrow), Type:=xlFillDefault
The issue I am having is this part,
Range("g6:g6").Select
Selection.AutoFill Destination:=Range("g6:g" & Lastrow), Type:=xlFillDefault
I need this part to be relative to the column and cell that is currently active not column G.
When I find the date (which btw is what the 'Sheets("Imports").Range("a1")' is), I then want to add the formula in all cells below this date until the lastrow.
I hope this makes sense, please ask any questions if you need to
Thanks in advance!
Nick
Bookmarks