View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Code to make a sheet active

When you open the workbook, set an object variable

Set oWB = Workbooks.Open Filename:= ... etc

and then use that object variable when activating.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"hshayh0rn" wrote in message
...
I have an active worksheet in a workbook that I need to grab some data off
of. The problem is the name of the workbook that the worksheet resides in
contains a date and time the workbook was created as part of the file

name.
I've tried to use wildcards* to acftivate the workbook but that doesn't

seem
to work. Here is an example of the code I'm trying to run that isn't

working:

Windows(BankNum & "-UserGroupReport" * ".csv").Activate

BankNum comes from user input
-UserGroupReport is static in the name
* represents the part of the file name that contains the date/time

I don't want to make this really complicated. Does anyone have any ideas?