#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Select Case

Is there a way the following code can be written where the places where 8 and
10 would depend on a cell value? If the cell value = 424 then

dim myCase as string
myCase = range("A1").value

for i = 28 to myCase

Select Case i
case 28, 127, 226, 325, myCase

or if the cell value = 10 then

case 28, 127, 226, 325, 424, myCase

the increment of the case is 99

End Select

Next

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Select Case

'where 8 and 10 would depend on a cell value' Don't really understand what
you mean here. However, if steps are always 99 then why not use something
like this:-

For i = 28 To myCase Step 99

'your code in here including test for cell value

Next


--
Regards,

OssieMac


"jnf40" wrote:

Is there a way the following code can be written where the places where 8 and
10 would depend on a cell value? If the cell value = 424 then

dim myCase as string
myCase = range("A1").value

for i = 28 to myCase

Select Case i
case 28, 127, 226, 325, myCase

or if the cell value = 10 then

case 28, 127, 226, 325, 424, myCase

the increment of the case is 99

End Select

Next

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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case AlanW Excel Programming 4 July 12th 07 07:32 AM
End Select without Select Case, Block If without End If errors Atreides Excel Programming 12 November 17th 06 05:10 PM
Need help on Select Case Susan Hayes Excel Worksheet Functions 1 November 3rd 04 10:25 PM


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