View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Shawn[_11_] Shawn[_11_] is offline
external usenet poster
 
Posts: 4
Default What is better Variables or TextBox ?

It would be faster to have the textbox results pasted to the worksheet and
do the have the formulas in your worksheet and then copy and paste speacial
the results where you want them. ie:

sheets("sheet1").range("a1").select
selection.contents=me.sbad.value
sheets(sheet1").range("a2").select
selection.contents = me.cad.value


Shawn


"Carlos" wrote in message
...
I have a Userform which does a LOT of calculatios but I´m using the direct
data from the Textboxes like this :

me.sbad.Value = Val(Me.sba) / Val(Me.tc)
me. cad.Value = Val(Me.ca) / Val(Me.tc)

Like these calculations I have a couple of hundred in the whole userform,
but then I have a button to display each result in a Worksheet, but it
takes
for ever to copy it to the worksheet, well like 20 seconds, But still its
a
lot of time just to copy and paste it to a worksheet.

I was wondering why is this happening ? and would it help if I use
variables
for all the calculations instead of the textboxes. Like this:

Dim salary as integer
dim wage as integer
dim rate as integer

salary= me.sba.Value
wage= me. ca.Value
rate=me.tc.value

me.sbad.Value = salary / rate
me. cad.Value = wage / rate

Thanks