Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Worksheet_Calculate problem

I have a worksheet_calculate event. This event is fired when I open another
sheet which does not have any events (or even a new sheet). The problem is
that when the new sheet opens, it gives an error saying that this_particular
sheet is not found. It is obviously looking for this_particular sheet in the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the above
event resides. The above checks for the sheetname, but I need the workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Worksheet_Calculate problem

This works fine:

Private Sub Worksheet_Calculate()
fname = Range("S2")
For Each bk In Workbooks
If Trim(left(bk.Name, Len(fname))) < fname Then Exit Sub
Next

but then is a FOR...NEXT required. No direct way to get the workbook name?

Mangesh





"Mangesh Yadav" wrote in message
...
I have a worksheet_calculate event. This event is fired when I open

another
sheet which does not have any events (or even a new sheet). The problem is
that when the new sheet opens, it gives an error saying that

this_particular
sheet is not found. It is obviously looking for this_particular sheet in

the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the above
event resides. The above checks for the sheetname, but I need the workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet_Calculate problem

Me.Parent.Name

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mangesh Yadav" wrote in message
...
This works fine:

Private Sub Worksheet_Calculate()
fname = Range("S2")
For Each bk In Workbooks
If Trim(left(bk.Name, Len(fname))) < fname Then Exit Sub
Next

but then is a FOR...NEXT required. No direct way to get the workbook name?

Mangesh





"Mangesh Yadav" wrote in message
...
I have a worksheet_calculate event. This event is fired when I open

another
sheet which does not have any events (or even a new sheet). The problem

is
that when the new sheet opens, it gives an error saying that

this_particular
sheet is not found. It is obviously looking for this_particular sheet in

the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the above
event resides. The above checks for the sheetname, but I need the

workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Worksheet_Calculate problem

Hi Bob,

Thanks very much.

Mangesh



"Bob Phillips" wrote in message
...
Me.Parent.Name

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mangesh Yadav" wrote in message
...
This works fine:

Private Sub Worksheet_Calculate()
fname = Range("S2")
For Each bk In Workbooks
If Trim(left(bk.Name, Len(fname))) < fname Then Exit Sub
Next

but then is a FOR...NEXT required. No direct way to get the workbook

name?

Mangesh





"Mangesh Yadav" wrote in message
...
I have a worksheet_calculate event. This event is fired when I open

another
sheet which does not have any events (or even a new sheet). The

problem
is
that when the new sheet opens, it gives an error saying that

this_particular
sheet is not found. It is obviously looking for this_particular sheet

in
the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the

above
event resides. The above checks for the sheetname, but I need the

workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet_Calculate problem

Always a pleasure to help a helper Mangesh :-)

Bob


"Mangesh Yadav" wrote in message
...
Hi Bob,

Thanks very much.

Mangesh



"Bob Phillips" wrote in message
...
Me.Parent.Name

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mangesh Yadav" wrote in message
...
This works fine:

Private Sub Worksheet_Calculate()
fname = Range("S2")
For Each bk In Workbooks
If Trim(left(bk.Name, Len(fname))) < fname Then Exit Sub
Next

but then is a FOR...NEXT required. No direct way to get the workbook

name?

Mangesh





"Mangesh Yadav" wrote in message
...
I have a worksheet_calculate event. This event is fired when I open
another
sheet which does not have any events (or even a new sheet). The

problem
is
that when the new sheet opens, it gives an error saying that
this_particular
sheet is not found. It is obviously looking for this_particular

sheet
in
the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the

above
event resides. The above checks for the sheetname, but I need the

workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Worksheet_Calculate problem

:)

Mangesh



"Bob Phillips" wrote in message
...
Always a pleasure to help a helper Mangesh :-)

Bob


"Mangesh Yadav" wrote in message
...
Hi Bob,

Thanks very much.

Mangesh



"Bob Phillips" wrote in message
...
Me.Parent.Name

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mangesh Yadav" wrote in message
...
This works fine:

Private Sub Worksheet_Calculate()
fname = Range("S2")
For Each bk In Workbooks
If Trim(left(bk.Name, Len(fname))) < fname Then Exit Sub
Next

but then is a FOR...NEXT required. No direct way to get the workbook

name?

Mangesh





"Mangesh Yadav" wrote in message
...
I have a worksheet_calculate event. This event is fired when I

open
another
sheet which does not have any events (or even a new sheet). The

problem
is
that when the new sheet opens, it gives an error saying that
this_particular
sheet is not found. It is obviously looking for this_particular

sheet
in
the
new opened sheet. How to avoid this. I am looking for a code like:

Private Sub Worksheet_Calculate()

If Me.Name < Range("S2") Then Exit Sub

where Range("S2") has the filename of the original sheet where the

above
event resides. The above checks for the sheetname, but I need the
workbook
name. I need something like
Workbook.Name




--
- Mangesh
------------------------------------------
Office XP & Windows XP












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
worksheet_calculate code Jase Excel Discussion (Misc queries) 1 October 29th 08 08:17 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 2 January 26th 07 01:16 PM
worksheet_calculate enyaw Excel Discussion (Misc queries) 0 January 26th 07 08:14 AM
Worksheet_Calculate event problem Otto Moehrbach[_6_] Excel Programming 2 October 28th 04 10:41 PM
worksheet_calculate **help** tommyboy Excel Programming 2 June 29th 04 08:33 AM


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