LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default using variable with .Activate

Hi

I'm trying to use a variable in the following code but i get an error.

Subscript out of range


I am runing a For/Next loop and need to change the file name for every
loop


Dim MyString AS String
Dim MyFileName AS String


MyString = C:\path\filename
MyFileName = somefilename



Windows(MyString).Activate

Sheets(MyFileNAme).Select


Any suggestion on how to do this correctly.


Many thanks
 
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
Workbook.Activate / Window.Activate problem Tim[_44_] Excel Programming 3 February 3rd 06 11:38 PM
Can a variable be used in a Worksheet().Activate method Brad Sumner Excel Programming 3 September 12th 05 07:09 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Reference to a variable in windows(???).Activate John Baker Excel Programming 7 July 13th 04 02:04 PM
How to activate a file when the filename is represented by a string variable news.sintef.no Excel Programming 4 February 6th 04 02:17 PM


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