f2e4
08-04-2009, 03:40 AM
Hey guys,
Its been about 6 months since I've had to do any VBA and think I may have forgotten a large portion so please bear with me on this one.
I have created a worksheet that acts like a finance summary sheet that can be tweaked to show you what the overall effect is on your longon term figures.
I am now trying to turn this worksheet into a userform (looks a bit more professional) that is going to pull data in from a worksheet - 'data sheet' in the same way as the original worksheet does.
OK..... so here are my queries:
1. How do I format a textbox?
The cells are formatted as #,##0 and I thought the following would work:
TextBox1 = Format(TextBox1, "#,##0")
2. How do I conditionally format a textbox? This is what I have been using:
If Val(TextBox11.Value) < "0" Then TextBox11.BackColor = RGB(255, 0, 0) 'Red
If Val(TextBox11.Value) > (Val(TextBox6.Value) * 0.025) Then TextBox11.BackColor = RGB(255, 134, 0) 'Orange
If Val(TextBox11.Value) > "0" & < (Val(TextBox6.Value) * 0.025)TextBox11.BackColor = RGB(0, 255, 0) 'Green '
This one is meant to be between 0 and the orange condition
3. Embarrasing Question: Why does this not work?
Val(Textbox11.value) = Val(Textbox6.value) - Val(Textbox1.value)
More questions on this userform to follow once these are answered.
Thanks again for all the help
Spreadsheets attached
Its been about 6 months since I've had to do any VBA and think I may have forgotten a large portion so please bear with me on this one.
I have created a worksheet that acts like a finance summary sheet that can be tweaked to show you what the overall effect is on your longon term figures.
I am now trying to turn this worksheet into a userform (looks a bit more professional) that is going to pull data in from a worksheet - 'data sheet' in the same way as the original worksheet does.
OK..... so here are my queries:
1. How do I format a textbox?
The cells are formatted as #,##0 and I thought the following would work:
TextBox1 = Format(TextBox1, "#,##0")
2. How do I conditionally format a textbox? This is what I have been using:
If Val(TextBox11.Value) < "0" Then TextBox11.BackColor = RGB(255, 0, 0) 'Red
If Val(TextBox11.Value) > (Val(TextBox6.Value) * 0.025) Then TextBox11.BackColor = RGB(255, 134, 0) 'Orange
If Val(TextBox11.Value) > "0" & < (Val(TextBox6.Value) * 0.025)TextBox11.BackColor = RGB(0, 255, 0) 'Green '
This one is meant to be between 0 and the orange condition
3. Embarrasing Question: Why does this not work?
Val(Textbox11.value) = Val(Textbox6.value) - Val(Textbox1.value)
More questions on this userform to follow once these are answered.
Thanks again for all the help
Spreadsheets attached