Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Referencing Worksheet code name in the following code

I am opening oWB and need to reference a worksheet code name in oWB. I have
the following:

Set oRevisionWS = Nothing
On Error Resume Next
oWB.Activate
oRevisionWS = Revisions <~~~worksheet code name
On Error GoTo 0

I need to know how to define oRevisionWS to be the worksheet with the code
name Revisions.

Thanks,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Referencing Worksheet code name in the following code

Sub a()
Dim WS As Worksheet
Dim oRevisionWS As Worksheet
For Each WS In Worksheets
If WS.CodeName = "Revisions" Then
Set oRevisionWS = WS
Exit For
End If
Next
If Not oRevisionWS Is Nothing Then MsgBox oRevisionWS.Name
End Sub


--
Jim
"Barb Reinhardt" wrote in message
...
|I am opening oWB and need to reference a worksheet code name in oWB. I
have
| the following:
|
| Set oRevisionWS = Nothing
| On Error Resume Next
| oWB.Activate
| oRevisionWS = Revisions <~~~worksheet code name
| On Error GoTo 0
|
| I need to know how to define oRevisionWS to be the worksheet with the code
| name Revisions.
|
| Thanks,
| Barb Reinhardt


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Referencing Worksheet code name in the following code

Thanks. This is one I just can't seem to remember how to do.

"Jim Rech" wrote:

Sub a()
Dim WS As Worksheet
Dim oRevisionWS As Worksheet
For Each WS In Worksheets
If WS.CodeName = "Revisions" Then
Set oRevisionWS = WS
Exit For
End If
Next
If Not oRevisionWS Is Nothing Then MsgBox oRevisionWS.Name
End Sub


--
Jim
"Barb Reinhardt" wrote in message
...
|I am opening oWB and need to reference a worksheet code name in oWB. I
have
| the following:
|
| Set oRevisionWS = Nothing
| On Error Resume Next
| oWB.Activate
| oRevisionWS = Revisions <~~~worksheet code name
| On Error GoTo 0
|
| I need to know how to define oRevisionWS to be the worksheet with the code
| name Revisions.
|
| Thanks,
| Barb Reinhardt



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
how to prevent code running when in a worksheet code Corey Excel Programming 5 August 13th 06 08:52 AM
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM
Referencing Libraries through code. Purnima Excel Programming 2 July 10th 05 03:23 PM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
Referencing a cell for a value in VBA code Todd Huttenstine[_2_] Excel Programming 2 November 18th 03 02:00 AM


All times are GMT +1. The time now is 08:38 AM.

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

About Us

"It's about Microsoft Excel"