need help with multiple sheets

offseyeds

New Member
Joined
Nov 17, 2004
Messages
25
I was wondering if using vba, if there is a way to select multiple sheets at once. There is a formula that i want inserted in multiple sheets. I want to be able to create a macro that inserts this formula all at once because there is approx 15 sheets. What i am trying to do is shorthand it to where i dim all the sheets as a variable and then select that variable and run the code. This is obviously not working or i wouldnt be asking for help.

Thanks
KB
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Not exactly sure what you want to do but I think this is what you're asking for

Public Sub addFormula()
Dim wks As Worksheet
For I = 1 To Application.Worksheets.Count

Set wks = Application.Worksheets(I)
wks.Range("cell you want formula in").Value = "=Formula" // whatever your formula is

Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,236
Messages
6,054,301
Members
444,715
Latest member
GlitchHawk

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