+ Reply to Thread
Results 1 to 6 of 6

VBA project using SendKeys

  1. #1
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Thumbs up VBA project using SendKeys

    Hi All,

    Can you please help me on using sendkeys for 'DATE' and 'TIME' function?

    I manually use for Date —› Ctrl + ;
    I manually use for Time —› Ctrl + Shift + ;

    If I use formulas - "=Today()" and "=Now()" in my VBA codes then I have to use copy & paste codes, so that the date & time get fixed, and don't change/ update if I use codes for the next time.

    Thanks in Advance!
    Last edited by SunOffice; 02-21-2011 at 11:05 AM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    1,252

    Re: VBA project using SendKeys

    Hi
    If I use formulas - "=Today()" and "=Now()" in my VBA codes then I have to use copy & paste codes, so that the date & time get fixed, and don't change/ update if I use codes for the next time.
    If you want to put the date/time into a cell, why don't you just use the VBA functions?

    eg.
    Please Login or Register  to view this content.
    Trust me, Sendkeys can be quite unreliable and should be avoided when possible.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Thumbs up Re: VBA project using SendKeys

    Please Login or Register  to view this content.
    Thanks Colin Legg for ur amazing help on this.
    ...and okay! I will try to avoid using the send-keys in my codes.
    Last edited by SunOffice; 02-21-2011 at 11:05 AM.

  4. #4
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Re: VBA project using SendKeys

    Is there any VBA code for entering Weekday's Names into the next cell like Monday, Tuesday etc.?
    for example below codes for the current time & date.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    1,252

    Re: VBA project using SendKeys

    Hi,

    Yes, you can use the Format function to do that, for example:
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-12-2010
    Location
    Excel World
    MS-Off Ver
    Excel 2013, 2019 & O365
    Posts
    214

    Smile Re: VBA project using SendKeys

    Thanks a world for ur amazing help!
    Please Login or Register  to view this content.
    P.S. - I'd like to learn these smart tricks.
    Last edited by SunOffice; 02-23-2011 at 04:37 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1