LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Randy
 
Posts: n/a
Default Use Sheet CodeNames to Select Sheet in Different Workbook

I'm using an .xla to make modifications to another workbook. In my
procedure, I'm need to test the name of each worksheet to determine how
to proceed. For some reason, I am unable to correctly point to capture
the sheet name in the other workbook. I have tried a few different
methods, none with any success.

Here is the abbreviated code:

Sub UnprotectSheets(strUpdateWb As String)
'where strUpdateWb is the name of an open workbook

Windows(strUpdateWb).Activate
Dim wb As Workbook
Set wb = ActiveWorkbook

'Attempt #1
Dim temp As String
temp = wb.Sheet1.Name
MsgBox (temp) 'yields a run-time error. code stops.

'Attempt #2
temp = Sheet1.Name
MsgBox (temp) 'gives me the sheet name from the xla. I need the
sheet name from the xls workbook

'Attempt #3
temp = strUpdateWb.Sheet1.Name
MsgBox (temp) 'run time error again

End Sub

Can anybody point me in the right direction?

Thanks,
Randy Eastland

 
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
Subset of one sheet on another sheet bxb7668 Excel Discussion (Misc queries) 3 April 25th 05 03:55 PM
Subset of one sheet on another sheet bxb7668 Excel Worksheet Functions 3 April 25th 05 03:55 PM
Impoting data from Sheet 1 to Sheet 2 a-leano Excel Discussion (Misc queries) 1 April 20th 05 01:05 AM
how can i select all the cells with same color on a sheet if there are multipale colors by vba code uobt Charts and Charting in Excel 1 December 15th 04 05:27 PM
Naming & renaming a sheet tab Cgbilliar Excel Worksheet Functions 1 November 7th 04 05:57 PM


All times are GMT +1. The time now is 02:40 PM.

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"