View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Minitman[_4_] Minitman[_4_] is offline
external usenet poster
 
Posts: 273
Default Help Converting Cell Formula To VBA Code

Hey Tom,

Sorry this took so long, had to work on other projects.

I tried to run this code and I kept getting a:

Compile error:
Else without If

The debugger then high lights this line: ( the word Else)

....(from the code below)
msg = msg & ", "& Textbox2.Text _
& " & " & Textbox3.Text
End if
Else <<<<<<<<
msg = Textbox6.Text
End If
TextBox7.Text = msg

I can't see what is wrong with this code!!!

Can anyone tell me why I keep getting this error?

TIA

-Minitman



On Wed, 3 Nov 2004 12:27:17 -0500, "Tom Ogilvy"
wrote:

Dim msg as String
IF Textbox6.Text = "" Then
msg = Textbox4.Text
IF Textbox2.Text = "" THen
IF Textbox3.Text ="" then
msg = msg
Else
msg = msg & ", " & Textbox3.Text
End if
Else
IF Textbox3.Text = "" then
msg = msg & ", " & Textbox2.Text
Else
msg = msg & ", "& Textbox2.Text _
& " & " & Textbox3.Text
End if
Else
msg = Textbox6.Text
End If
TextBox7.Text = msg

--
Regards,
Tom Ogilvy