LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Getting error using if then else stmt

Hi ub.
If Month(Worksheets("Sheet1").Cells(rwIndex, 12).Value) _
Month(Mydate) Then .Interior.Color = RGB(255, 0, 0)

If and Then on the same row, end the IF instruction.

For rwindex = 4 To 100
If Month(Cells(rwindex, 12).Value) Month(Mydate) Then
Cells(rwindex, 12).Interior.Color = RGB(255, 0, 0)
ElseIf Month(Cells(rwindex, 12).Value) = "" Then
Cells(rwindex, 12).Interior.ColorIndex = 6
Else
Cells(rwindex, 12).Interior.ColorIndex = 6
End If
Next

Regards
Eliano



"ub" wrote:

Hi
I am using the follwoing code,
For rwIndex 4 to 100
If Month(Worksheets("Sheet1").Cells(rwIndex, 12).Value) _
Month(Mydate) Then .Interior.Color = RGB(255, 0, 0)
ElseIf Month(Worksheets("Sheet1").Cells(rwIndex, 12).Value) = "" Then
Worksheets("Sheet1").Cells(rwIndex, 12).Interior.Color = 2
Else
Worksheets("Sheet1").Cells(rwIndex, 12).Interior.Color = 2
End If


System gives me 'Complie Error'
Else without if.


Please advise, what is wrong with my code


 
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
Wild Cards with IF stmt KarenF Excel Worksheet Functions 5 August 3rd 07 11:07 PM
Rounding down from .9 in an IF stmt GenaM Excel Worksheet Functions 1 August 2nd 06 11:16 PM
if stmt trouble vencopbrass Excel Discussion (Misc queries) 2 February 25th 06 10:57 AM
URGENT need help with if/then stmt. Melissa H. Excel Worksheet Functions 4 October 26th 05 10:08 PM
IF Stmt. for cumulative commissions. Shams Excel Discussion (Misc queries) 4 August 10th 05 07:04 PM


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