Resolve date entry issue from TextBoxes into ws

underpressure

Board Regular
Joined
Nov 24, 2012
Messages
141
TextBoxes 1, 2, 3 are intended for date of birth entry into a ws.

The ws is formatted as Date mm/dd/yy

ws.Cells(iRow, 4).Value = Me.TextBox1.Value & Me.TextBox2.Value & Me.TextBox3.Value

TextBox entries = 05 12 52
Ws formula bar = 04/26/2040

I can’t figure out a workaround for this issue.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi,
try

Code:
'TextBox3 = Year
'TextBox1 = Month
'TextBox2 = Day

ws.Cells(iRow, 4).Value = DateSerial(Me.TextBox3.Value, Me.TextBox1.Value, Me.TextBox2.Value)

Note: DateSerial is Entered Year Month Day.


Dave
 
Upvote 0
Dave, thanks for the suggestion.
But, that creates different issues.
I suppose I'll need to rethink the data entry and revise my project.
Appreciate you helping...several times now! I'll drink a beer in your honor.
 
Upvote 0
OK, I fixed it with this:

Code:
If TextBox11.Value = "" Then
    ws.Cells(iRow, 11).Value = ""
    Else
    ws.Cells(iRow, 11).Value = Me.TextBox11.Value & "/" & Me.TextBox12.Value & "/" & TextBox13.Value
End If

This fits everything in the project except when I’m calling for another UserForm to be populated from the worksheet.

I can’t figure out the correct nomenclature for:
UserFormUpdate.TextBox11, 12, and 13 need to translate the date from Cells.(iRow, 11)

iRow 11 = date - i.e. 09/25/76

so that Textbox11.value = 09
Textbox12.value = 25, and
Textbox13.value = 76

I’ve tried some Left, Mid, and Right statements but without success.
 
Last edited:
Upvote 0
Have a look at the Day, Month & Year functions
 
Upvote 0
Thanks, Fluff...

Can Const currDate = a worksheet cell?

For example, this doesn’t work:
Const currDate = "ws.Cells(iRow, 11).Value"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top