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: 1
Default Need help creating a case statement

I'm sure there is a better way to do this, but this is all I can come u
with. If you notice below the only thing different between the tw
groups of code is: Cell.Offset(0,33) and Cell.Offset(0,34)
And j = 0 to 6 changes to k = 7 to 13


Is there a way to use a case statement so I do not have to keep writin
the code over and over.

I need to continue incrementing the offset, and the for variable quit
a few more times.


For Each Cell In Range("D3:AJ19")
If [D$1] = [$B3] And [D$1] <= [$C3] And _
[E24] = [AK1] And Cell.Offset(0, 33) = 2 Then
For j = 0 To 6
Cell.Offset(0, j).Value = [AK$1]
Next j

If [D$1] = [$B3] And [D$1] <= [$C3] And _
[E24] = [AK1] And Cell.Offset(0, 34) = 2 Then
For k = 7 To 13
Cell.Offset(0, k).Value = [AL$1]
Next k

Thank

--
Message posted from http://www.ExcelForum.com

 
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 Statement jlclyde Excel Discussion (Misc queries) 3 December 4th 08 05:04 PM
IF STATMENT OR CASE STATEMENT Richard Excel Discussion (Misc queries) 2 January 10th 07 10:04 AM
Anyone actually get Case statement to work ... ? ForestFeeder Excel Worksheet Functions 3 April 21st 06 04:14 PM
CASE statement equivalent Beema Excel Worksheet Functions 1 December 15th 04 09:32 AM
Case statement smi Excel Programming 2 October 18th 03 02:20 PM


All times are GMT +1. The time now is 10:47 PM.

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"