+ Reply to Thread
Results 1 to 3 of 3

Same Code runs different in VBA-Macro VS manual clicking

  1. #1
    Registered User
    Join Date
    05-07-2015
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    1

    Same Code runs different in VBA-Macro VS manual clicking

    Hey guys,

    I've got this strange issue - been using vba for years (albeit in amateur-ish ways) but never come across anything like this. Any help would be awesome!

    1. I have a data sheet with dates in one column but excel filter foes not recognise them as dates
    2. Problem is easy to fix manually, just select the column then: Data>TextToColumns> --- then select "Delimited" ; in the next screen make sure no Delimiters are selected; in the next screen select "Date" - "DMY"
    3. This does the trick but i have many columns like this in new worksheets all the time
    4. When i record this as a macro and run it from vba it doesn't work.


    When i record the macro, this is the code it generates:

    Please Login or Register  to view this content.

    BUT when i execute the exact same code (on a worksheet where the data hasn't been changed already) from VBA it does not work

    Here is a screencast showing what is happening: http://www.screencast.com/t/rse8QpqK
    Here is the data: https://www.dropbox.com/s/e0jmsch1xx...ount.xlsx?dl=0


    thanks so much

    Gesh
    Last edited by alansidman; 11-18-2016 at 02:50 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Same Code runs different in VBA-Macro VS manual clicking

    Try this code. Select the range for which you would like to convert the dates and run this macro:

    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Same Code runs different in VBA-Macro VS manual clicking

    @geshak83

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. When clicking object, swich between manual and automatic formula.
    By jokris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2016, 01:22 AM
  2. [SOLVED] Macro code that runs despite specific cells being locked.
    By TBM in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 01-26-2016, 08:56 PM
  3. [SOLVED] NEED HELP! Code that checks all data has been entered before my VBA Macro Runs!
    By Dremzy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-20-2014, 01:11 PM
  4. Manual code a macro to print worksheets
    By Chatters in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2013, 07:35 PM
  5. [SOLVED] code behind the command button that runs another macro
    By Vogelmann in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2012, 06:04 AM
  6. MACRO code on right-clicking a cell
    By choachristopher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2011, 09:47 PM
  7. Halt all code while macro runs
    By TimT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2005, 12:05 PM

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