Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am sure this should be easy :
I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
tested. it work Private Sub Text11_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub Text9_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- I am sure this should be easy : I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi again.
forget the last post. i forgot where i was at and did that for access. sorry here is excel Private Sub TextBox1_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub TextBox2_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- hi, tested. it work Private Sub Text11_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub Text9_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- I am sure this should be easy : I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus . . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just note that your doing a string compare which may or may not work.
I suggest you do Private Sub TextBox1_Change() If cDate(Me.TextBox1.Value) cDate(Me.TextBox2.Value) Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub -- Regards, Tom Ogilvy wrote in message ... hi again. forget the last post. i forgot where i was at and did that for access. sorry here is excel Private Sub TextBox1_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub TextBox2_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- hi, tested. it work Private Sub Text11_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub Text9_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- I am sure this should be easy : I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus . . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
.... and this works? Or not.
Geof. -----Original Message----- hi again. forget the last post. i forgot where i was at and did that for access. sorry here is excel Private Sub TextBox1_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub TextBox2_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- hi, tested. it work Private Sub Text11_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub Text9_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- I am sure this should be easy : I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus . . . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks all I think it works although sometimes the
textbox does automatically change when date is entered. -----Original Message----- .... and this works? Or not. Geof. -----Original Message----- hi again. forget the last post. i forgot where i was at and did that for access. sorry here is excel Private Sub TextBox1_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub TextBox2_Change() If Me.TextBox1.Value Me.TextBox2.Value Then Me.TextBox1.ForeColor = RGB(255, 7, 64) 'red Else Me.TextBox1.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- hi, tested. it work Private Sub Text11_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub Private Sub Text9_BeforeUpdate(Cancel As Integer) If Me.Text9.Value Me.Text11.Value Then Me.Text9.ForeColor = RGB(255, 7, 64) 'red Else Me.Text9.ForeColor = RGB(7, 183, 20) 'green End If End Sub -----Original Message----- I am sure this should be easy : I am trying to get excel to do a calculation via textboxes. For example If textbox1.value textbox2.value then Textbox1.forecolor = "red" else Textbox1.forecolor = "green" end if It maybe a little more complex because my values are in date format. i.e. textbox1 = "01 jan 2003" textbox2 = "01 jan 2004" Many thanks in advance MArcus . . . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
text calculation | Excel Discussion (Misc queries) | |||
month text in calculation | Excel Worksheet Functions | |||
Use of text and calculation in a formula | Excel Discussion (Misc queries) | |||
Put in text after a calculation | Excel Discussion (Misc queries) | |||
Calculation within Text | Excel Worksheet Functions |