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.
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
I'd probably use:

Code:
Range("E3").Formula = "=IF(ISNUMBER(E3),PML!S10,"""")"
 

jonathann3891

Board Regular
Joined
Apr 27, 2015
Messages
109
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
 

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
Sure. For example:

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

Range("G3").Copy
Range("G4:G67").Paste
 

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
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,"""")"
 

Watch MrExcel Video

Forum statistics

Threads
1,123,337
Messages
5,601,026
Members
414,422
Latest member
acegreen

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
Top