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: 204
Default Using variable names in a loop

Thanks for your help with solving the userform controls naming when using a
loop. I also have 5 public variables (as date) called time1, time2, time3,
time4 and time5. They are used in the following code. They used to work fine
when i did it 5 separate times but in order to minimise code i tried,

For Box = 5 to 1 step -1

Cells(riderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Text(("Time" & box), "[hh]:mm:ss")

I'm guessing I need some form of code to let it know that "time" & 5 is a
variable name not the text time5.

I am now starting to understand why I thought it was safer to have 5 times
as much code. I'm sure it's simple but can anybody help me.

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
Loop with variable name? Mike Excel Discussion (Misc queries) 6 April 25th 09 05:12 AM
For Each ... Next loop - need to reference the loop variable [email protected] Excel Programming 4 July 13th 06 06:12 PM
Loop with variable Knut Excel Programming 2 November 19th 05 02:48 PM
Loop through Worksheet Names No Name Excel Programming 15 May 20th 04 11:50 AM
Loop using cell names Matt Excel Programming 3 January 21st 04 09:36 PM


All times are GMT +1. The time now is 08:57 AM.

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"