Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default Trouble with Elseif command

Hello all...

trying to run the following simple program but it will not run. Have tried
the offline help and followed the example to the letter but with no luck.
Any ideas would be appreciated.


Sub ContractHighlight()
'
' ContractHighlight Macro
' Macro recorded 23/11/2004 by Keith Holden
'

'If h4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 3

ElseIf i4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 2

End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Trouble with Elseif command

'If range("h4").value 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 3

ElseIf range("i4").value 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 2

End If
End Sub
-----Original Message-----
Hello all...

trying to run the following simple program but it will

not run. Have tried
the offline help and followed the example to the letter

but with no luck.
Any ideas would be appreciated.


Sub ContractHighlight()
'
' ContractHighlight Macro
' Macro recorded 23/11/2004 by Keith Holden
'

'If h4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 3

ElseIf i4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 2

End If
End Sub

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Trouble with Elseif command


"if" was commented by mistake .

remove the comment
try this

Sub ContractHighlight()
'
' ContractHighlight Macro
' Macro recorded 23/11/2004 by Keith Holden
'

If h4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 3

ElseIf i4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 2

End If
End Su

--
anilsolipura
-----------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627
View this thread: http://www.excelforum.com/showthread.php?threadid=31985

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Trouble with Elseif command

"Keith" wrote in message ...
Hello all...

trying to run the following simple program but it will not run. Have tried
the offline help and followed the example to the letter but with no luck.
Any ideas would be appreciated.


Sub ContractHighlight()
'
' ContractHighlight Macro
' Macro recorded 23/11/2004 by Keith Holden
'

'If h4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 3

ElseIf i4 1 Then
Range("A4:M4").Select
Selection.Interior.ColorIndex = 2

End If
End Sub


If you mean it will not go to the elseif part then it is probably
because the first part was true and therefore never went to the elseif
part.

-Pete
Reply
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
ELSEIF Loop to End Robbie Doo Excel Discussion (Misc queries) 0 January 13th 10 11:11 PM
Elseif? ibrokit Excel Worksheet Functions 5 November 25th 08 04:28 PM
if elseif flow23 Excel Discussion (Misc queries) 0 November 14th 05 02:09 PM
ElseIf tom1646 Excel Programming 4 October 19th 04 02:09 PM
If...Elseif...End If javab98 Excel Programming 2 July 19th 04 07:23 PM


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

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"