Multiplying textboxes

Schofi_D

New Member
Joined
Sep 13, 2017
Messages
4
Hi All

I have 15 text boxes in my userform that i want to multiply by a corresponding text box and total in one text box

Example quantity is one text box (textbox37) and cost is the other textbox (textbox52) i want to multiply them two together but need to do this for all textboxes to get a total, i have tried the following, and belieiving thats the way to do it, it keeps returning an error, its early and maybe my brain hasnt woke up yet but waht am i missing? or what have i done wrong here?

Code:
TextBox63.Value = Format((TextBox48.Value * TextBox33.Value) + (TextBox49.Value * TextBox34.Value) + (TextBox50.Value * TextBox35.Value) + (TextBox51.Value * TextBox36.Value) + (TextBox52.Value * TextBox37.Value) + (TextBox53.Value * TextBox38.Value) + (TextBox54.Value * TextBox39.Value) + (TextBox55.Value * TextBox40.Value) + (TextBox56.Value * TextBox41.Value) + (TextBox57.Value * TextBox42.Value) + (TextBox58.Value * TextBox43.Value) + (TextBox59.Value * TextBox44.Value) + (TextBox60.Value * TextBox45.Value) + (TextBox61.Value * TextBox46.Value) + (TextBox62.Value * TextBox47.Value), "£###,###,##0.00")

Help is always appreciated :)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Your best bet is to break that line into each of the multiplications and debug.print the values before that code
Debug.Print "48*33" & (TextBox48.Value * TextBox33.Value)
Debug.Print "49*34" & (TextBox49.Value * TextBox34.Value)
Debug.Print "50*35" & (TextBox50.Value * TextBox35.Value)
etc
which should crash on the bad line or check in the immediate window to see which one is giving you the error then debug.print the values from each of the text boxes before the row above that crashed

it may be one of the text boxes doesn't have a value set?
 
Last edited:
Upvote 0
Your best bet is to break that line into each of the multiplications and debug.print the values before that code
Debug.Print "48*33" & (TextBox48.Value * TextBox33.Value)
Debug.Print "49*34" & (TextBox49.Value * TextBox34.Value)
Debug.Print "50*35" & (TextBox50.Value * TextBox35.Value)
etc
which should crash on the bad line or check in the immediate window to see which one is giving you the error then debug.print the values from each of the text boxes before the row above that crashed

it may be one of the text boxes doesn't have a value set?

Hi Johnny thanks for this, you're actually spot on half the text boxes are blank, i can put some code in to say if its blank then make it 0, hopefully that works
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,351
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top