View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
hotherps[_58_] hotherps[_58_] is offline
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