View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Help Converting Cell Formula To VBA Code

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

--
Regards,
Tom Ogilvy
"Minitman" wrote in message
...
Greetings,

I have a formula that is working well in a cell that I need to convert
to VBA code. Here is the ordinal cell formula broken out logically:

IF(G216="",
E216&IF(C216="",
IF(D216="",
"",
", "&D216),
IF(D216="",
", "&C216,
", "&C216&" & "&D216)),
G216)

Here is the conversion from cells to TextBoxes:

C216 = TextBox2
D216 = TextBox3
E216 = TextBox4
G216 = TextBox6

I need to put the result of this formula into TextBox7

Any help would be most appreciated.

TIA

=Minitman