LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Compile Error ElseIf Without If.........But there is an If ! ???

When you have the action on the same line as the If , there is no closing
End If required. As you have Else clauses, you need to structre it like so

If (Range("D9").Value) < 0 Then
Range("D9").ClearContents:
UserForm6.Show
ElseIf (Range("D9").Value) 125 Then
Range("D9").ClearContents
UserForm6.Show
End If


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"dim" wrote in message
...
Hi folks,

Can someone please try and debug this code for me? ARGHHHH!! I just don't
get it, why am I getting the compile error, there is obviously an 'If' so
why
is it saying there's not?

If (Range("D9").Value) < 0 Then Range("D9").Select:
Selection.ClearContents:
UserForm6.Show
ElseIf (Range("D9").Value) 125 Then Range("D9").Select:
Selection.ClearContents: UserForm6.Show
End If

Thankyou for any advice.



 
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
Compile error:.......?? Geo Excel Discussion (Misc queries) 1 October 19th 07 01:01 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
VBA Error Message "Compile Error...." Steve Excel Discussion (Misc queries) 3 July 15th 05 09:20 AM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


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