Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default object by variable name

Maybe, maybe not.

If you change your CodeNames so that they end in 01, 02, ... 10 you might be
able to do what you want in one loop.

For each wks in Worksheets
strTail = Right(wks.Codename, 2)
If IsNumeric(strTail) then
Select Case Int(strTail)
Case 1 to 10
'Do something to this wks that ends in a number between 01 &
10
Case Else
'Do nothing to this wks that ends in a number 10
EndSelect
Else
'Do nothing to this wks that doesn't end in a number.
End if
Next wks

The trick may be to adopt a naming convention that allows you to handle
CodeNames efficiently in a loop like this.

--
George Nicholson

Remove 'Junk' from return address.

"Ricky M. Medley" wrote in message
...
yeah....your last suggestion sounds like a viable one. {go through each

one
until if finds the right one}, but my code is so long already, and is
starting to take time to execute...my goal is to keep every execution

under
500 miliseconds. This would take two loops...one to go through 1-10, and
one to go through each worksheet. Thanks though...I will try to see if

time
is under limits.

ricky


"George Nicholson" wrote in message
...
<<snip
Because of this, the specific loop you envision may not be possible.
However, you could do a For..Each loop on the Worksheets collection and

then
do a SelectCase on the CodeName within that loop.






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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
object variable or with block variable not set Diego Excel Discussion (Misc queries) 1 August 9th 05 02:46 PM
Error 91 - Object variable with block variable not set Jim[_35_] Excel Programming 2 November 27th 03 03:34 AM
Object Variable or With Block variable not set? Chris M.[_3_] Excel Programming 3 August 26th 03 04:30 PM


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