#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to?

I need to gather some counts from a worksheet and return
them to another sheet.

Workbook #1 Sheet 1 RC A3 is to hold the totals from
Workbook #2 Sheet 1 RC to be determined by inspection.
This calculation should occur when Workbook #1 is opened.

I have the code necessary to find and calculate the
totals in a worksheet_activate sub for Workbook #2 Sheet
#1, but can't get it to be triggered without manually
opening the sheet, then clicking in another sheet, then
back to the 1st sheet.

What events can be triggered by just opening Workbook #1?

Can you assist?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default How to?

There is a workbook open event. You could do something
like this:

Private Sub Workbook_Open()
Dim wb As Workbook

'For each workbook that is currently open
For Each wb In Workbooks
'If workbook named "Workbook2.xls" is open
If wb.Name = "Workbook2.xls" Then
'Run your code and exit sub
'Put your code here or call a procedure
Exit Sub
End If
Next wb
'If Workbook2 is not open nothing happens

End Sub

tod
-----Original Message-----
I need to gather some counts from a worksheet and return
them to another sheet.

Workbook #1 Sheet 1 RC A3 is to hold the totals from
Workbook #2 Sheet 1 RC to be determined by inspection.
This calculation should occur when Workbook #1 is opened.

I have the code necessary to find and calculate the
totals in a worksheet_activate sub for Workbook #2 Sheet
#1, but can't get it to be triggered without manually
opening the sheet, then clicking in another sheet, then
back to the 1st sheet.

What events can be triggered by just opening Workbook #1?

Can you assist?
Thanks.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to?

Thanks Tod.

Does the Workbook open event occur when any workbook is
opened? Can I open workbook 2 from the open event in
workbook 1 and activate the workbook 2 worksheet 1?
What would that code look like?

Thanks again.
-----Original Message-----
There is a workbook open event. You could do something
like this:

Private Sub Workbook_Open()
Dim wb As Workbook

'For each workbook that is currently open
For Each wb In Workbooks
'If workbook named "Workbook2.xls" is open
If wb.Name = "Workbook2.xls" Then
'Run your code and exit sub
'Put your code here or call a procedure
Exit Sub
End If
Next wb
'If Workbook2 is not open nothing happens

End Sub

tod
-----Original Message-----
I need to gather some counts from a worksheet and

return
them to another sheet.

Workbook #1 Sheet 1 RC A3 is to hold the totals from
Workbook #2 Sheet 1 RC to be determined by inspection.
This calculation should occur when Workbook #1 is

opened.

I have the code necessary to find and calculate the
totals in a worksheet_activate sub for Workbook #2

Sheet
#1, but can't get it to be triggered without manually
opening the sheet, then clicking in another sheet, then
back to the 1st sheet.

What events can be triggered by just opening Workbook

#1?

Can you assist?
Thanks.
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default How to?

Each workbook you open has its own Workbook Open event.
If you put code in the Open event of a particular
workbook, that code will run whenver that workbook is
opened, but not when other workbooks are opened. Let me
know if you have more questions.

tod

-----Original Message-----
Thanks Tod.

Does the Workbook open event occur when any workbook is
opened? Can I open workbook 2 from the open event in
workbook 1 and activate the workbook 2 worksheet 1?
What would that code look like?

Thanks again.
-----Original Message-----
There is a workbook open event. You could do something
like this:

Private Sub Workbook_Open()
Dim wb As Workbook

'For each workbook that is currently open
For Each wb In Workbooks
'If workbook named "Workbook2.xls" is open
If wb.Name = "Workbook2.xls" Then
'Run your code and exit sub
'Put your code here or call a procedure
Exit Sub
End If
Next wb
'If Workbook2 is not open nothing happens

End Sub

tod
-----Original Message-----
I need to gather some counts from a worksheet and

return
them to another sheet.

Workbook #1 Sheet 1 RC A3 is to hold the totals from
Workbook #2 Sheet 1 RC to be determined by inspection.
This calculation should occur when Workbook #1 is

opened.

I have the code necessary to find and calculate the
totals in a worksheet_activate sub for Workbook #2

Sheet
#1, but can't get it to be triggered without manually
opening the sheet, then clicking in another sheet,

then
back to the 1st sheet.

What events can be triggered by just opening Workbook

#1?

Can you assist?
Thanks.
.

.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"