Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Text Box Calculation

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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Text Box Calculation

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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Text Box Calculation

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Text Box Calculation

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Text Box Calculation

.... 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Text Box Calculation

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
text calculation Joy Excel Discussion (Misc queries) 2 November 12th 09 01:39 PM
month text in calculation T. Valko Excel Worksheet Functions 2 July 23rd 08 05:41 PM
Use of text and calculation in a formula Bella Excel Discussion (Misc queries) 2 March 19th 08 04:56 PM
Put in text after a calculation joel Excel Discussion (Misc queries) 2 October 16th 06 08:55 AM
Calculation within Text GeorgeF Excel Worksheet Functions 6 November 18th 05 05:23 PM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"