On the edge of Scrapping and re-design, any help on VBA filling a formula accross to end of columns + Rows

Viewed 34

Im on the last stage of a build and I have come to a stumbling block, if I cant resolve this its a whole new design

What I am trying to do is take the Active cell formula and fill across to the end of the columns, then fill down however the results its giving me is the same formula with the same data across all columns. The formula is not adjusting as it moves across the columns.

results 1

Results should be - done manually

Using module 1 this is run able but produces results in pic 1, but I need the results in 2

link to test data https://www.dropbox.com/scl/fi/2vz1z7uap2u3dqnks02g5/test-Automated-clearing-report.xlsm?dl=0&rlkey=fr9vifmheu50m01ab44rvlcil

my code which works (module 1)

Sub Macro4()
'


'
    Range("GRIR_Table[[#Headers],[Ageing Catagory]]").Select
    Cells.Find(What:="AP Researched by", After:=ActiveCell, LookIn:= _
        xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
        
     ActiveCell.Offset(1, 0).Activate
     ActiveCell.Formula2R1C1 = "=IFERROR(INDEX(ImportTable[[ Researched by]],MATCH(GRIR_Table[@[PO/PO Line]:[PO/PO Line]],ImportTable[[PO/PO Line]:[PO/PO Line]],0)),"""")"
 
 

 Range("AD2", Cells(LastRow, LastCol)).FormulaR1C1 = Range("AD2").FormulaR1C1



 Dim GRrepLastColumn As Long, GRrepLastRow As Long
    GRrepLastColumn = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
    GRrepLastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

    Range(ActiveCell, Cells(ActiveCell.Row, GRrepLastColumn)).FillRight
    Range(ActiveCell, Cells(GRrepLastRow, GRrepLastColumn)).FillDown
 
End Sub

any help to finish would be great

thanks

Dave

0 Answers
Related