you have to put your GoTo Getout on a separate line, if the initial
result of the IF is on the same line, then it doesn't see it as a
multiline IF.
On 3 Oct, 21:41, JHB <[EMAIL PROTECTED]> wrote:
> I am totally new to Visual Basic, and am working on an Excel
> spreadsheet. I have a number of macros, and one that I cannot make
> work. It is as follows:
>
> Sub setlowest()
> '
> ' setlowest Macro
> ' Macro recorded 10/3/2008 by John
> '
> Sheets("Menu").Select
>
> If Range("D33").Value > Range("d42").ValueThen Then GoTo getout
> Else
> Range("D33").Select
> Selection.Copy
> Range("D42").Select
> ActiveSheet.Paste
> Range("C33").Select
> Selection.Copy
> Range("E42").Select
> ActiveSheet.Paste
> End If
> getout:
> End Sub
>
> I get an error that I have an "else" statement without an "if". I can
> see the "if" there but its clear that there is something I have not
> done that I should have done. Can someone tell me what I need to do to
> make this macro work, please.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment
You may subscribe to group Feeds using a RSS Feed Reader to stay upto date
using following url
<a href="http://feeds.feedburner.com/DotNetDevelopment">
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---