Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-09-24
12
Medium Priority
?
45 Views
Last Modified: 2016-09-25
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"
0
Comment
Question by:Omar Hernandez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 22

Expert Comment

by:Roy Cox
ID: 41813631
ws.Cells(iRow, 1).Value =Date

Open in new window

0
 

Author Comment

by:Omar Hernandez
ID: 41813633
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)
0
 
LVL 22

Expert Comment

by:Roy Cox
ID: 41813641
Change the Format

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

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Omar Hernandez
ID: 41813642
It keeps showing the format as "mm/dd/yyyy"
0
 
LVL 22

Accepted Solution

by:
Roy Cox earned 2000 total points
ID: 41813655
Try

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

Open in new window


Are the cells pre-formatted to "mm/dd/yyyy"
0
 
LVL 33

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41813669
Maybe this?
ws.Cells(iRow, 1).NumberFormat = "m/d/yy"
ws.Cells(iRow, 1).Value = Format(Date, "m/d/yy")

Open in new window

0
 

Author Comment

by:Omar Hernandez
ID: 41813975
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.
0
 
LVL 33

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41814026
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.
0
 

Author Closing Comment

by:Omar Hernandez
ID: 41814060
Thanks Roy Cox this worked great
0
 
LVL 22

Expert Comment

by:Roy Cox
ID: 41814349
Pleased to help.
0
 
LVL 33

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41814453
:)
0
 
LVL 22

Expert Comment

by:Roy Cox
ID: 41814614
Having seen the mention of your calendar then the formatting should be done within the calendar form.

See my example workbook
Calendar-Forms.xlsm
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question