Avatar of Omar Hernandez
Omar Hernandez
 asked on

Have today date appear automatically on the a column when using this macro

How can i get the date to appear on the first column of the row when using this macro.

'copy the data to the database
        ws.Cells(iRow, 1).Value =
        ws.Cells(iRow, 3).Value = "          " & Me.textbox_name.Value
        ws.Cells(iRow, 4).Value = Me.Label4.Caption
        ws.Cells(iRow, 5).Value = Me.Label3.Caption
        ws.Cells(iRow, 6).Value = Me.Label5.Caption
        ws.Cells(iRow, 7).Value = "2"
Microsoft Excel

Avatar of undefined
Last Comment
Roy Cox

8/22/2022 - Mon
Roy Cox

ws.Cells(iRow, 1).Value =Date

Open in new window

Omar Hernandez

ASKER
Hey Roy Cox, it works wanted to know if there is a way to change the way it looks (9/24/2016) to this (9/24/16)
Roy Cox

Change the Format

ws.Cells(iRow, 1).Value =Format(Date,"mm/dd/yy")

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Omar Hernandez

ASKER
It keeps showing the format as "mm/dd/yyyy"
ASKER CERTIFIED SOLUTION
Roy Cox

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Subodh Tiwari (Neeraj)

Maybe this?
ws.Cells(iRow, 1).NumberFormat = "m/d/yy"
ws.Cells(iRow, 1).Value = Format(Date, "m/d/yy")

Open in new window

Omar Hernandez

ASKER
Thank's again Neeraj the last suggestion that you have provided, works phenomenal. I have a pop up calendar function that when i click on cells it automatically pops up.

In order for that the pop up calendar to appear i would need to
1. Right click on the cell where i want the calendar to pop up.
2. On the number column of the box i need to click then on date.
3. Type of date 3/14/12

***Any way i can implement so that it can record this function on the macro.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Subodh Tiwari (Neeraj)

You're question is not clear to me.
As you said, you already have a code to input a date through the calendar pop up in a cell and I assume that works for you. So do you want to apply the same number format to that date cell or what?

It would be helpful if you can upload a sample workbook so that it would be easy to visualize your requirement more clearly.
Omar Hernandez

ASKER
Thanks Roy Cox this worked great
Roy Cox

Pleased to help.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Subodh Tiwari (Neeraj)

:)
Roy Cox

Having seen the mention of your calendar then the formatting should be done within the calendar form.

See my example workbook
Calendar-Forms.xlsm