FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I have a spreadsheet with multiple columns. I would like to record all of the formulas into VBA for the sole purposes of restoring those formulas if lost or damaged somehow.
I know I can manually take the steps in VBA by turning on the macro recorder, entering the cells and selecting F2, hit tab and that formula will be written into VBA in the R1C1 format as seen below. Is there a way to automate this to where I can find the last column of row 1 and have this process look thru row 2 starting at A2 and finding a cell with a formula and recording it to VBA?
I know I can manually take the steps in VBA by turning on the macro recorder, entering the cells and selecting F2, hit tab and that formula will be written into VBA in the R1C1 format as seen below. Is there a way to automate this to where I can find the last column of row 1 and have this process look thru row 2 starting at A2 and finding a cell with a formula and recording it to VBA?
VBA Code:
Sub Macro2()
ActiveCell.Formula2R1C1 = _
"=FILTER(Attendance!R4C1:INDEX(Attendance!C1,LastRow),Attendance!R4C2:INDEX(Attendance!C2,LastRow)=1)"
Range("B2").Select
End Sub