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

Dim wb As Workbook
Dim ws As Worksheet

For Each wb In Workbooks
'Test to see if wb's name is like "ExportedData*"
If wb.Name Like "ExportedData*" Then
'Create a worksheet object to reference the appropriate
'worksheet in the wb

'Why does this work...
Set ws = wb.ActiveSheet

'But this doesn't?
Set ws = wb.Worksheet("Tally sheet")

How do I make the second one work? Once I find the specified workbook I
need to select a specific sheet (Tally Sheet) in the workbook.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Worksheet selection

Try

Set ws = wb.Worksheets("Tally sheet")
--
If this post helps click Yes
---------------
Jacob Skaria


"Bishop" wrote:

Dim wb As Workbook
Dim ws As Worksheet

For Each wb In Workbooks
'Test to see if wb's name is like "ExportedData*"
If wb.Name Like "ExportedData*" Then
'Create a worksheet object to reference the appropriate
'worksheet in the wb

'Why does this work...
Set ws = wb.ActiveSheet

'But this doesn't?
Set ws = wb.Worksheet("Tally sheet")

How do I make the second one work? Once I find the specified workbook I
need to select a specific sheet (Tally Sheet) in the workbook.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Worksheet selection

On May 21, 12:22*pm, Bishop wrote:
Dim wb As Workbook
Dim ws As Worksheet

For Each wb In Workbooks
* 'Test to see if wb's name is like "ExportedData*"
* If wb.Name Like "ExportedData*" Then
* * 'Create a worksheet object to reference the appropriate
* * 'worksheet in the wb

'Why does this work...
Set ws = wb.ActiveSheet

'But this doesn't?
Set ws = wb.Worksheet("Tally sheet")

How do I make the second one work? *Once I find the specified workbook I
need to select a specific sheet (Tally Sheet) in the workbook.


Bishop,

You are missing an "s" on the end of "Worksheet" in your second
example. It should read "Set ws = wb.Worksheets("Tally sheet")".

Best,

Matthew Herbert
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
Lock worksheet, based on dropdown selection prior worksheet Michele New Users to Excel 9 June 21st 09 10:31 PM
worksheet selection greg Excel Programming 3 May 28th 08 05:35 PM
worksheet selection change Jacob Excel Programming 0 December 5th 06 04:46 PM
Multiple Worksheet Selection Peter-d Excel Programming 11 September 6th 06 03:24 AM
Worksheet Selection Gazza Excel Programming 3 May 5th 05 05:45 PM


All times are GMT +1. The time now is 05:28 PM.

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"