If...then...else Statement

Smurfit-Stone

Active Member
Joined
Dec 1, 2004
Messages
485
Hello Board,
I recorded a macro and now I need to tweek it to include a If statement.
I have a summary sheet and various other sheets that the information on the summary sheet pulls from. I want to use a If, Then, Else statement to look at the value in A2, (month). If its August then select cells B4:G4 and insert a formula {(=Smith!AugustSales)} else if its September insert formula {(Smith!SeptemberSales)}, else if its October insert ({Smith!OctoberSales)} and so on till next July. Can anyone help, I'm running out of time....Thanks!
 
The only other thing I can think of that may be causeing your problem is if the range A3 does NOT contain simple TEXT January/February etc.. But if A3 is a DATE Formatted to show just the month, this would cause a problem.

To adjust for that try

Code:
Range("B6:G6").FormulaArray = "='Forecast August 2007.xls'!" & Format(Range("A3").Value,"mmmm")
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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