LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default If - End if problem

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
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
Colon at the end of excel file name(ex: problem.xls:1, problem.xls financeguy New Users to Excel 2 January 15th 10 01:15 AM
Started out as an Access problem. Now an Excel problem RobertM Excel Discussion (Misc queries) 2 April 26th 06 07:30 PM
problem with a conditional max problem Brian Cornejo Excel Discussion (Misc queries) 1 February 18th 05 06:25 PM
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? OCI Excel Programming 0 May 16th 04 10:40 PM


All times are GMT +1. The time now is 12:12 AM.

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"