View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default VB calculations

Tim,

See code snippets in-line.

HTH,
Bernie
MS Excel MVP


"timmulla" wrote in message
...
Can anyone help me do the following calculations in a excel userform.

I have two calendar 10.0 controls (Calendar1 and Calendar2).
Calendar1.value relates to a start date and calendar2.value relates to an end
date. I'm trying to have the number of days between Calendar1 and Calendar2
show up in a conrtol labeledTextBox8, when Commandbutton1 is clicked.


Depends: something like:

Userform1.TextBox8.Text = Userform1.Calendar2.value - Userform1.Calendar1.Value
Userform1.TextBox8.Text = Userform1.Calendar2.value - Userform1.Calendar1.Value + 1

TextBox1 - Numerical user input expressed as a percentage (i.e. 10%,this is
a % fee charged on an account).

TextBox2 - Numerical user input expressed a dollar amount (i.e. $100,000,
this is account value).

TextBox3 - I'm trying to have the value of TextBox1.value * Texbox2.value
show up when Commandbutton1 is clicked.


UserForm1.TextBox3.Text = _
Format(Val(UserForm1.TextBox1.Text) / 100 * _
Val(UserForm1.TextBox2.Text), "00.00")


TextBox4 - I'm trying to have TextBox3.value/365 show up when Commandbutton1
is clicked (This will give me a daily rate).



UserForm1.TextBox4.Text = _
Format(Val(UserForm1.TextBox3.Text) / 365, "00.00")

TextBox5 - I'm trying to have TextBox8.value * TextBox5.value show up when
Commandbutton1 is clicked.


UserForm1.TextBox5.Text = _
Format(Val(UserForm1.TextBox8.Text) * _
Val(UserForm1.TextBox5.Text), "00.00")

Though be careful with this one... multiple clicks will give you problems.