Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repetitive IF THEN Statement
Below is my code:
Sub CalculateProfit() OrderForm.TextBox119.Value = OrderForm.TextBox9.Value + OrderForm.TextBox14.Value + OrderForm.TextBox19.Value + OrderForm.TextBox24.Value + _ OrderForm.TextBox29.Value + OrderForm.TextBox34.Value + OrderForm.TextBox39.Value + OrderForm.TextBox44.Value + _ OrderForm.TextBox49.Value + OrderForm.TextBox54.Value + OrderForm.TextBox59.Value + OrderForm.TextBox64.Value + _ OrderForm.TextBox69.Value + OrderForm.TextBox74.Value + OrderForm.TextBox79.Value + OrderForm.TextBox84.Value + _ OrderForm.TextBox89.Value + OrderForm.TextBox94.Value + OrderForm.TextBox99.Value + OrderForm.TextBox104.Value + _ OrderForm.TextBox109.Value + OrderForm.TextBox114.Value End Sub Here is the problem, if anyone of the above TextBoxes.Value is "Select", then "Select" will be 1 of the values in TextBox119. Is there anyway I can remove or ignore all the TextBox.Values that equal "Select" without having to write a ton of IF THEN statements? Todd Huttenstine |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Repetitive IF THEN Statement
Todd,
Sub CalculateProfit() Dim strTemp as String strTemp = OrderForm.TextBox9.Value + OrderForm.TextBox14.Value + OrderForm.TextBox19.Value + OrderForm.TextBox24.Value + _ OrderForm.TextBox29.Value + OrderForm.TextBox34.Value + OrderForm.TextBox39.Value + OrderForm.TextBox44.Value + _ OrderForm.TextBox49.Value + OrderForm.TextBox54.Value + OrderForm.TextBox59.Value + OrderForm.TextBox64.Value + _ OrderForm.TextBox69.Value + OrderForm.TextBox74.Value + OrderForm.TextBox79.Value + OrderForm.TextBox84.Value + _ OrderForm.TextBox89.Value + OrderForm.TextBox94.Value + OrderForm.TextBox99.Value + OrderForm.TextBox104.Value + _ OrderForm.TextBox109.Value + OrderForm.TextBox114.Value OrderForm.TextBox119.Value = Replace(strTemp, "Select", "") End Sub Rob "Todd Huttenstine" wrote in message ... Below is my code: Sub CalculateProfit() OrderForm.TextBox119.Value = OrderForm.TextBox9.Value + OrderForm.TextBox14.Value + OrderForm.TextBox19.Value + OrderForm.TextBox24.Value + _ OrderForm.TextBox29.Value + OrderForm.TextBox34.Value + OrderForm.TextBox39.Value + OrderForm.TextBox44.Value + _ OrderForm.TextBox49.Value + OrderForm.TextBox54.Value + OrderForm.TextBox59.Value + OrderForm.TextBox64.Value + _ OrderForm.TextBox69.Value + OrderForm.TextBox74.Value + OrderForm.TextBox79.Value + OrderForm.TextBox84.Value + _ OrderForm.TextBox89.Value + OrderForm.TextBox94.Value + OrderForm.TextBox99.Value + OrderForm.TextBox104.Value + _ OrderForm.TextBox109.Value + OrderForm.TextBox114.Value End Sub Here is the problem, if anyone of the above TextBoxes.Value is "Select", then "Select" will be 1 of the values in TextBox119. Is there anyway I can remove or ignore all the TextBox.Values that equal "Select" without having to write a ton of IF THEN statements? Todd Huttenstine |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Repetitive macros | Excel Discussion (Misc queries) | |||
filtering for repetitive entries | Excel Discussion (Misc queries) | |||
Repetitive Numbers | Excel Discussion (Misc queries) | |||
Repetitive keystroke | Excel Discussion (Misc queries) | |||
repetitive | Excel Discussion (Misc queries) |