Home |
Search |
Today's Posts |
#14
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Papa J
The indentations shouldn't make a difference. If you look at what you posted, and what I posted, you will see the difference in line 3 of mine versus Line 2 of yours: PJ: Else: If locale = "L" Then Selection.Interior.ColorIndex = 6 RR: ElseIf locale = "L" Then Selection.Interior.ColorIndex = 6 As Richard pointed out, you will find it easier, in the long run, to not use the ":" at all to combine lines, but rather to put the information on separate lines. Best wishes, --ron On Tue, 18 Dec 2007 12:11:01 -0800, Papa Jonah wrote: Apparently, after cutting and pasting yours, the only difference I see is the indentation of yours between If and End if - but yours works. Thanks "Ron Rosenfeld" wrote: On Mon, 17 Dec 2007 14:44:34 -0800, Papa Jonah wrote: Rick, I have tried that. However, when I use "ElseIf" I still get a compile error "else without if" and highlights "ElseIf locale = "L" then" This is what I have currently: If locale = "P" Then Selection.Interior.ColorIndex = 3 Else: If locale = "L" Then Selection.Interior.ColorIndex = 6 Else: Selection.Interior.ColorIndex = 9 End If When I run the macro, I am currently getting a "Compile Error - Else without If" with the first "Else:" highlighted. I don't see the difference in what I have tried and what has been suggested - but it still isn't working. Thanks for bearing with me. Papa J This: If locale = "P" Then Selection.Interior.ColorIndex = 3 ElseIf locale = "L" Then Selection.Interior.ColorIndex = 6 Else: Selection.Interior.ColorIndex = 9 End If or this: If locale = "P" Then Selection.Interior.ColorIndex = 3 ElseIf locale = "L" Then Selection.Interior.ColorIndex = 6 Else Selection.Interior.ColorIndex = 9 End If Both work OK here. --ron --ron |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |