ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98 (https://www.excelbanter.com/excel-programming/316552-syntax-insert-number-into-one-trxtbox-if-different-textbox-has-date-%3D-1-1-98-a.html)

Minitman[_4_]

Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98
 
Greetings,

In an Exit event I need to see if the date value in TextBox1 is =
9/15/1998. If yes, then the value in TextBox 7 needs to be .0825. If
not, the value in TextBox7 needs to be.08.
I tried this:

If TextBox1.Value = "9/15/1998" Then
TextBox7.Value = "8.25%"
Else:
TextBox7.Value = "8%"
End If

But it only returns .0825 in TextBos7, no matter what the date is in
TextBox1.

What am I doing wrong?

Can anyone help me?

TIA

-Minitman

mangesh_yadav[_191_]

Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98
 

The code works correctly with me. maybe instead of = you should put

--
mangesh_yada

-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27761


E Oveson[_3_]

Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98
 
Hey Minitman,

try this:

Dim date1 As Date

date1 = TextBox1.Value
If date1 = "9/15/1998" Then
TextBox2.Value = "8.25%"
Else
TextBox2.Value = "8%"
End If

-Erik

"Minitman" wrote in message
...
Greetings,

In an Exit event I need to see if the date value in TextBox1 is =
9/15/1998. If yes, then the value in TextBox 7 needs to be .0825. If
not, the value in TextBox7 needs to be.08.
I tried this:

If TextBox1.Value = "9/15/1998" Then
TextBox7.Value = "8.25%"
Else:
TextBox7.Value = "8%"
End If

But it only returns .0825 in TextBos7, no matter what the date is in
TextBox1.

What am I doing wrong?

Can anyone help me?

TIA

-Minitman




Minitman[_4_]

Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98 - SOLVED
 
Hey Erik,

That was the answer - I did not have TextBox1 Dimmed as a date. Thank
you, this now works.

-Minitman

On Thu, 11 Nov 2004 22:17:31 -0800, "E Oveson"
wrote:

Hey Minitman,

try this:

Dim date1 As Date

date1 = TextBox1.Value
If date1 = "9/15/1998" Then
TextBox2.Value = "8.25%"
Else
TextBox2.Value = "8%"
End If

-Erik

"Minitman" wrote in message
.. .
Greetings,

In an Exit event I need to see if the date value in TextBox1 is =
9/15/1998. If yes, then the value in TextBox 7 needs to be .0825. If
not, the value in TextBox7 needs to be.08.
I tried this:

If TextBox1.Value = "9/15/1998" Then
TextBox7.Value = "8.25%"
Else:
TextBox7.Value = "8%"
End If

But it only returns .0825 in TextBos7, no matter what the date is in
TextBox1.

What am I doing wrong?

Can anyone help me?

TIA

-Minitman




Minitman[_4_]

Syntax To Insert A Number Into One TrxtBox If A Different TextBox Has A Date That Is = 1/1/98 - Solved
 
Hey Mangesh,

Thanks for the reply. I do appreciate it.

Changing the order (= to =) was part of the solution. The other
part was dimming the date as date.

I forgot to mention that I am running Excel 2003 on a Win 2k box.
This may also have been a factor.

-Minitman

On Fri, 12 Nov 2004 00:02:31 -0600, mangesh_yadav
wrote:


The code works correctly with me. maybe instead of = you should put =




All times are GMT +1. The time now is 06:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com