Restore Formula VBA

jonathann3891

Board Regular
Joined
Apr 27, 2015
Messages
109
I'm trying to write a simple macro that will restore my formulas in a certain column.

The formula is: =IF(ISNUMBER(E3),PML!S10,"")

I can not get it to work with the equal symbol in the formula. Is there a simplier way to accomplish this?

Also every cell in the column has to have the representing number in place of E3.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I'd probably use:

Code:
Range("E3").Formula = "=IF(ISNUMBER(E3),PML!S10,"""")"
 
Upvote 0
Is there a faster solution than this?

Code:
Sheets("Sheet 1").Activate
Range("G3").Formula = "=IF(ISNUMBER(E3),PML!S10,"""")"
Range("G4").Formula = "=IF(ISNUMBER(E4),PML!S10,"""")"
Range("G5").Formula = "=IF(ISNUMBER(E5),PML!S10,"""")"
Range("G6").Formula = "=IF(ISNUMBER(E6),PML!S10,"""")"
Range("G7").Formula = "=IF(ISNUMBER(E7),PML!S10,"""")"

The range is going all the way to G67 on 25 Sheets
 
Upvote 0
Sure. For example:

Code:
Sheets("Sheet 1").Activate
Range("G3").Formula = "=IF(ISNUMBER(E3),PML!S10,"""")"

Range("G3").Copy
Range("G4:G67").Paste
 
Upvote 0
That's still fine. E3 in your formula is a relative reference, so the next row would reference E4, then E5 etc as you go down.

It would be a problem if we locked the reference. Such as "=IF(ISNUMBER($E$3),PML!S10,"""")"
 
Upvote 0

Forum statistics

Threads
1,214,773
Messages
6,121,473
Members
449,033
Latest member
Kcolwell16

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