+ Reply to Thread
Results 1 to 7 of 7

User Input Date Loop Macro

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    User Input Date Loop Macro

    Hi all,

    Hope all is well in your macro worlds!

    I am having trouble with a user input macro.

    The user inputs a date for a macro to search a row for.

    The dates in the row are in a dd-mmm-yy format and I am unsure why the loop is not copying my test data.

    Would someone mind having a look into it for me?

    I have copied the macro below and input the Excel file if willing?


    Please Login or Register  to view this content.

    Many thanks in advance!


    Coeus.
    Attached Files Attached Files
    Last edited by Leith Ross; 07-16-2013 at 04:16 PM. Reason: Added Code Tags

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: User Input Date Loop Macro

    Coeus,

    Here's how I would do it, this is just one way of many...
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: User Input Date Loop Macro

    Hi tigeravatar!

    Many many thanks for the amazingly fast response.

    I'll be honest that macro is a bit beyond me - understand very little of it.

    Was my approach really far out? Would you be willing to modify my original macro if it can be done - I'm just not sure if I'm capturing and looping the user input correctly. I think the format typed into the user input is not working correctly when looping through my target data


    Thanks again,

    Coeus.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: User Input Date Loop Macro

    Hello Coeus,

    One problem with your code is you are using a reserved VBA word Month As a variable. Never redefine an existing VBA function in your code.

    The other problem is you never assign the date input to the variable.

    I have revised your code so it works.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    01-22-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: User Input Date Loop Macro

    Hi Leith Ross,

    I understand! Thanks very much I will add comments to my code so I don't forget in the future!

    Really appreciate it!


    Coeus.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: User Input Date Loop Macro

    Hello Coeus,

    You're welcome.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: User Input Date Loop Macro

    You might look at this test for a valid entry.
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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. user defined macro to replace certain characters in a string based on user input
    By whatappears in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2012, 06:25 PM
  2. Automatic Formula Input Based on User Input Using a Macro
    By Drayloc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2012, 12:10 PM
  3. Pause macro for user input then search for user's answer across multiple sheets
    By sassy2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-04-2009, 03:55 AM
  4. Do while Loop that is conditional based upon user input?
    By gplush in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2009, 02:01 AM
  5. [SOLVED] User input macro for a date.
    By StargateFanFromWork in forum Excel General
    Replies: 5
    Last Post: 05-05-2005, 12:06 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