Workbook Open

Ralph M

Well-known Member
Joined
Apr 16, 2002
Messages
502
Office Version
  1. 2016
Platform
  1. Windows
I have 15 sheets in my Workbook and want to put code in the Workbook Open, the code works but I want the data to be entered on 5 different sheets in the same workbook with the same cell references. I have tried the
select method and it still only enters the data on one sheet. Can someone help? thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
If (Now() >= A109) Then
Workbooks("C Shift Time 4-15-02.xls").Worksheets("sup sample", "413 sample").Activate
Range("B110") = 14
Range("I110") = 12
End If
 
Upvote 0
On 2002-04-17 11:48, Ralph M wrote:
If (Now() >= A109) Then
Workbooks("C Shift Time 4-15-02.xls").Worksheets("sup sample", "413 sample").Activate
Range("B110") = 14
Range("I110") = 12
End If

I'm assuming that this function works for the first sheet but you want to know how to make it work for the other 4 sheets. I hope this is pretty simple, I've tweaked your code slightly and have used a workbook with sheets named "Sheet1", "Sheet2" and "Sheet3" in this example:

<pre>
Worksheets((Array("Sheet1", "Sheet2", "Sheet3"))).Select
Sheets("Sheet1").Range("B110").Value = "14"
Sheets("Sheet1").Range("I110").Value = "12"</pre>

You can change the names to whatever your sheetnames are and put this code within your "If" statement.

HTH
 
Upvote 0
Did you change the sheet names to your actual sheet names? i.e.Change "Sheet1", "Sheet2" and "Sheet3" to whatever the names of your sheets are. (plus add in the names of the other two sheets you've got).

If this code isn't getting placed in the actual workbook that these sheets are in, you'll also need to add in the ...Workbooks("blah blah") ...bit that you had in the original code.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,011
Members
448,935
Latest member
ijat

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