Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default How call procedure when worksheet opened?

The following macro call works fine when a specific cell is updated. How do I
call the macro when the worksheet is first opened?

Private Sub Worksheet_Activate(ByVal Target As Excel.Range)
If Target.Address = Range("hanwono").AddressLocal Then Call
PullExistingDataToHand
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How call procedure when worksheet opened?

In the ThisWorkbook module

Private Sub Workbook_Open()
' any conditions you might want
PullExistingDataToHand
End Sub

See Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm


--
Regards,
Tom Ogilvy

"John" wrote in message
...
The following macro call works fine when a specific cell is updated. How

do I
call the macro when the worksheet is first opened?

Private Sub Worksheet_Activate(ByVal Target As Excel.Range)
If Target.Address = Range("hanwono").AddressLocal Then Call
PullExistingDataToHand
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How call procedure when worksheet opened?

Use the Workbook_Open event, not Activate

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"John" wrote in message
...
The following macro call works fine when a specific cell is updated. How

do I
call the macro when the worksheet is first opened?

Private Sub Worksheet_Activate(ByVal Target As Excel.Range)
If Target.Address = Range("hanwono").AddressLocal Then Call
PullExistingDataToHand
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default How call procedure when worksheet opened?

Tim, I'm pretty new at this VBA stuff, but I think this is almost all I need.
What condition to I check to be sure I'm on the "Hand" sheet to call this
procedure?

"Tom Ogilvy" wrote:

In the ThisWorkbook module

Private Sub Workbook_Open()
' any conditions you might want
PullExistingDataToHand
End Sub

See Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm


--
Regards,
Tom Ogilvy

"John" wrote in message
...
The following macro call works fine when a specific cell is updated. How

do I
call the macro when the worksheet is first opened?

Private Sub Worksheet_Activate(ByVal Target As Excel.Range)
If Target.Address = Range("hanwono").AddressLocal Then Call
PullExistingDataToHand
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How call procedure when worksheet opened?

Private Sub Workbook_Open()
If lcase(ThisWorkbook.Activesheet.Name) = "hand" then
PullExistingDataToHand
End if
End Sub

If you only want it to run when you open workbook and the default sheet is
named "Hand"

--
Regards,
Tom Ogilvy


"John" wrote in message
...
Tim, I'm pretty new at this VBA stuff, but I think this is almost all I

need.
What condition to I check to be sure I'm on the "Hand" sheet to call this
procedure?

"Tom Ogilvy" wrote:

In the ThisWorkbook module

Private Sub Workbook_Open()
' any conditions you might want
PullExistingDataToHand
End Sub

See Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm


--
Regards,
Tom Ogilvy

"John" wrote in message
...
The following macro call works fine when a specific cell is updated.

How
do I
call the macro when the worksheet is first opened?

Private Sub Worksheet_Activate(ByVal Target As Excel.Range)
If Target.Address = Range("hanwono").AddressLocal Then Call
PullExistingDataToHand
End Sub






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


Similar Threads
Thread Thread Starter Forum Replies Last Post
to call procedure in a worksheet in a module CAPTGNVR Excel Discussion (Misc queries) 4 January 30th 07 09:39 PM
Call a procedure in the workbook from a worksheet Selina Excel Programming 3 April 21st 05 01:04 PM
Call Procedure Ronbo Excel Programming 4 February 23rd 05 08:11 PM
Where else to look for procedure call Lulu Excel Programming 0 November 24th 04 03:07 PM
call procedure bob Excel Programming 1 August 9th 03 12:40 AM


All times are GMT +1. The time now is 08:15 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"