+ Reply to Thread
Results 1 to 6 of 6

Problem with Sendkeys Macro

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Problem with Sendkeys Macro

    I am having trouble making this work could anyone help please?

    Lr2 is H6827 and is variable. I just want to do an F2 and Enter on the cell.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Problem with Sendkeys Macro

    Why? Why would you want to do that? What are you actually trying to achieve? Using SendKeys is a very bad idea and is not recommended.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Re: Problem with Sendkeys Macro

    The file is a download and some of the cells are formatted to text. So I have built a macro to make various changes and this is the last part - I have to put calculations in various cells on the worksheet.

    SendKeys was recommended to me years ago as a way to write F2 Enter into a macro. I have hardly ever used it but the one time I come to use it it won't work.

    I wasn't aware it was a bad idea and not recommended.

    Can you suggest something else?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Problem with Sendkeys Macro

    There are various ways. Text to Columns, Paste Special, macro: format as General and use .value = .value.

    It should be possible to record and generalise any of the options.

    Can you upload a sample workbook?

    Regards, TMS

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Problem with Sendkeys Macro

    what type of data is you want to format..?
    There is an another way ie. TEXT TO COLUMNS..

    For example some time what a data is copied or pasted / Exported then gets converted into text
    so we generally have to press F2 on the cell and press ENTER to make it normal..

    there is an alternative as well
    select the range you want to format..
    Press text to columns button and press next ---> next ---> Finish..

    It will automatically change the format..

    Regards,
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Problem with Sendkeys Macro

    It's not recommended because it is unreliable and difficult to control. You can end up sending key presses at the wrong time or to the wrong application.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SendKeys problem
    By Alexander40 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2009, 08:52 PM
  2. SendKeys Problem
    By ElmerS in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-25-2009, 05:03 AM
  3. SendKeys problem
    By Gordon Rainsford in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2006, 05:00 AM
  4. SendKeys problem
    By Zakynthos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2005, 03:05 PM
  5. sendkeys problem
    By jmoffat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2005, 01:05 PM

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