+ Reply to Thread
Results 1 to 5 of 5

How to combine a code and a macro

  1. #1
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Thumbs up How to combine a code and a macro

    Hello folks,
    I have a code and recorded macro. Could you please help me to merge the codes into one to be able to work with different range of data set?

    Code #1: Combine files in a folder into a workbook
    Please Login or Register  to view this content.
    Code #2: A recorded macro to convert 5 columns worksheet to 3 columns (Combining YMD columns into "Date" column)
    The problem here is, I have to run the code for each worksheet separately, and I don't know how to do it for a workbook since the data range is not fixed.
    I couldn't use the "Range("A" & Rows.Count).End(xlUp).Row" function correctly.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Moriexcel; 12-20-2015 at 10:00 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: How to combine a code and a macro

    Try this,
    I used a sheet names "Start". When you run the code, the code will delete all the sheets except sheets("Start")
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 12-20-2015 at 09:43 AM.

  3. #3
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to combine a code and a macro

    It works like a charm. Thank you very much for the time.
    May I ask you one more question? IF POSSIBLE !
    Is it possible to guide me how to do VLOOKUP in this code between the sheets based on "DATE" column?
    I can do it by using the excel VLOOKUP, but how can I extend it to multiple sheets?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: How to combine a code and a macro

    Enter the date in Sheets("Starts") range("A2") and run the code.



    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-08-2014
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    84

    Re: How to combine a code and a macro

    Thanks a million.

+ 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. Combine two pieces of code together
    By ttontis in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-29-2015, 12:41 PM
  2. [SOLVED] how to combine code
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2015, 02:02 PM
  3. [SOLVED] Change Event Code too long - Need to combine 2 events into 1 macro
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2014, 03:57 AM
  4. [SOLVED] If code same combine the description
    By Klitos in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2013, 05:16 AM
  5. [SOLVED] Combine code in VBA
    By clifton1230 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2013, 12:21 AM
  6. [SOLVED] Using Combine macro to combine multiple worksheets - need to modify to paste formulas
    By DLSmith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2012, 09:07 AM
  7. combine code
    By Dennisli2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-12-2008, 12:17 AM

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