Solved

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

Posted on 2016-09-24
12
27 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
  • 5
  • 4
  • 3
12 Comments
 
LVL 17

Expert Comment

by:Roy_Cox
Comment Utility
ws.Cells(iRow, 1).Value =Date

Open in new window

0
 

Author Comment

by:Omar Hernandez
Comment Utility
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 17

Expert Comment

by:Roy_Cox
Comment Utility
Change the Format

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

Open in new window

0
 

Author Comment

by:Omar Hernandez
Comment Utility
It keeps showing the format as "mm/dd/yyyy"
0
 
LVL 17

Accepted Solution

by:
Roy_Cox earned 500 total points
Comment Utility
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 28

Expert Comment

by:Subodh Tiwari (Neeraj)
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Omar Hernandez
Comment Utility
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 28

Expert Comment

by:Subodh Tiwari (Neeraj)
Comment Utility
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
Comment Utility
Thanks Roy Cox this worked great
0
 
LVL 17

Expert Comment

by:Roy_Cox
Comment Utility
Pleased to help.
0
 
LVL 28

Expert Comment

by:Subodh Tiwari (Neeraj)
Comment Utility
:)
0
 
LVL 17

Expert Comment

by:Roy_Cox
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now