Formula change in vba

drop05

Active Member
Joined
Mar 23, 2021
Messages
285
Office Version
  1. 365
Platform
  1. Windows
Hello i am trying to do a formula change in VBA within that is within a for statement and an offset, but not sure if i am doing this right here is my code below
what i am trying to do is use a for loop with 1 to 3 for now, then the first formula im trying to change is on F44 then want it to offset over 0 rows but 4 columns so then the next cell the formula should be placed in on J44 then over another 4 columns on N44 and so on

I am not getting it right and wanted to check the logic to edit, thank you!


VBA Code:
Sub test()

Dim page As Workbook
Set page = Application.ThisWorkbook

Dim page_ws As Worksheet
Set page_ws = page.Worksheets("Page 1")

Dim page_list As Worksheet
Set page_list = page.Worksheets("Pace Check")


For i = 1 To 3


    page_ws.Range("F44").Offset(, i+3).Formula = "=IF(IFERROR(VLOOKUP(E7,'Pace Check'!$G$4:$R$200,12,FALSE),0) = ""Please fill out""," - -", IFERROR(VLOOKUP(E7,'Pace Check'!$G$4:$R$200,12,FALSE),0))"
    
Next i


End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Sorry just noticed something with the formula
for F44 it should be

=IF(IFERROR(VLOOKUP(E7,'Pace Check'!$G$4:$R$200,11,FALSE),0) = "Please fill out","--", IFERROR(VLOOKUP(E7,'Entity Control List'!$G$4:$R$200,12,FALSE),0))

then on j44 it will be
=IF(IFERROR(VLOOKUP(I7,'Entity Control List'!$G$4:$R$200,11,FALSE),0) = "Please fill out","--", IFERROR(VLOOKUP(I7,'Entity Control List'!$G$4:$R$200,12,FALSE),0))

N44
=IF(IFERROR(VLOOKUP(N7,'Entity Control List'!$G$4:$R$200,11,FALSE),0) = "Please fill out","--", IFERROR(VLOOKUP(N7,'Entity Control List'!$G$4:$R$200,12,FALSE),0))

and so on, sorry for the change i just noticed that as it goes down in columns i do not need it exactly the same formula, kinda like if i copied it from F44 then pasted the formula into J44 it will change on its own
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top