+ Reply to Thread
Results 1 to 3 of 3

How to change the criteria into variable in the recorded MS query macro ?

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    How to change the criteria into variable in the recorded MS query macro ?

    I record a macro when I do the MS query data.
    The resulted macro as follow :

    Please Login or Register  to view this content.
    The "bulan" means Month, The "tahun" means Year.

    My plan is that before the query runs, I use application.inputbox (or maybe listbox/combobox with month option in userform),
    so the user can input what month and year he wants to query.

    To check whether it will work or not, I've tried this first:
    Please Login or Register  to view this content.
    But it doesn't work.
    It didn't threw me an error message, but the query result contains all months which are in the "linked" data.

    How do I have to code ?

    And also, as seen in the recorded macro - what does it mean
    Please Login or Register  to view this content.
    Any kind of help would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: How to change the criteria into variable in the recorded MS query macro ?

    If bulan is a variable, try change to
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: How to change the criteria into variable in the recorded MS query macro ?

    Hi Jindon,
    It works. Thank you very much.

+ 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. Change recorded macro to remove all the selects... trying to learn how.
    By barman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-16-2018, 04:11 PM
  2. [SOLVED] How to change a recorded macro based on a field value?
    By AccountingJ in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-02-2017, 01:57 AM
  3. change recorded macro to vba
    By deek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2016, 01:16 PM
  4. [SOLVED] Need to change a recorded macro/use wildcards
    By Wheelie686 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2012, 12:48 PM
  5. [SOLVED] How to run a recorded macro when cell values change?
    By Clue_Less in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-15-2012, 12:01 PM
  6. How do I change a recorded macro to make it general?
    By excelVBAn00b in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2012, 03:38 PM
  7. Replies: 2
    Last Post: 01-26-2005, 08:06 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