+ Reply to Thread
Results 1 to 6 of 6

Adjust a macro to work with dynamic ranges

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    manchester, England
    MS-Off Ver
    2010
    Posts
    8

    Adjust a macro to work with dynamic ranges

    Hi all this is my first post so please bare with me if I ramble too much or am not very clear, I will try to explain in as much detail as possible......
    I am pretty new to working with VBA and Macro's and wondered if anybody could help. I have a worksheet (Pending) that gets updated daily from a second worksheet (Payments) and want to use a Macro to make the whole process a lot quicker, as I have several worksheets that I have to do similar actions for so I could use the same Macro on these worksheets to cut the time spent updating them considerably. In a nutshell the "Pending" worksheet contains a list of reference numbers in column B starting from Row 7 and the "Payments" sheet contains all the payments that have come in that day with reference numbers that correspond to Column B in the "Pending" worksheet. I currently run a Vlookup in the "Pending" sheet to match references from the "Payments" sheet and filter out any N/A. I would like to be able to run a macro to do this automatically, but when I have recorded the Macro it will only work if the number of rows in each sheet is the same everyday, but this differs and so one day there could be 10 rows on the payments sheet and 80 rows on pending, then the next day 40 rows on the payment sheet and 240 rows on pending. Is there a better way of doing this that can be automated, or any VBA code I could put into the macro to make it run for all the rows with a reference number

    Thanks in advance

  2. #2
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2010
    Posts
    212

    Re: Adjust a macro to work with dynamic ranges

    It would be much easier to understand if you could post with a sample book.

  3. #3
    Registered User
    Join Date
    09-08-2014
    Location
    manchester, England
    MS-Off Ver
    2010
    Posts
    8

    Re: Adjust a macro to work with dynamic ranges

    Hi here are examples of the 2 worksheets attached. Basically what I need to do is match the files in the "Payments" worksheet of the "New packs in" workbook with the "pending" sheet of the "pending & accepted" Workbook using the reference number - Column A in the "new packs in" workbook and Column B in the "Pending & Accepted" workbook. Any duplicates then need to be cut from the "Pending" worksheet in "Pending and accepted" and pasted to the bottom of the "Accepted" sheet and the blank rows deleted, then any files on the "payments" worksheet that are not matched on the "Pending" Worksheet need to be added to the bottom of the "Pending" Worksheet. Then the whole process needs to be repeated using the "Packs" Worksheet on the "New packs in" Workbook.
    The main problem I am encountering is that the number of rows in all the worksheet vary on a daily basis.

    Hope that makes sense?
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Adjust a macro to work with dynamic ranges

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-08-2014
    Location
    manchester, England
    MS-Off Ver
    2010
    Posts
    8

    Re: Adjust a macro to work with dynamic ranges

    Hi John thanks for your response, this works perfectly finding and matching the files from the payments and packs sheets with any already on the pending sheet and them moving those files onto the accepted sheet, so thanks for your help that will save me so much time. However, and sorry to be a pain, I also need any files on the payments and packs sheets that do not match files already on the pending sheet to then be added to the bottom of the pending sheet. Does that make sense and can this also be done?

    Thanks in anticipation

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Adjust a macro to work with dynamic ranges

    Thought it would do that, try:

    Please Login or Register  to view this content.

+ 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. Macro for Dynamic Ranges
    By shg in forum Tips and Tutorials
    Replies: 6
    Last Post: 08-07-2013, 06:35 AM
  2. Getting Dynamic ranges to work properly
    By ncarrocino in forum Excel General
    Replies: 1
    Last Post: 02-07-2013, 03:46 PM
  3. [SOLVED] Getting sumifs and dynamic ranges to work together
    By DRFILL in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-05-2012, 11:53 AM
  4. Dynamic Name Ranges don't adjust when new range inserted?
    By cedarhill in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-07-2009, 11:23 AM
  5. Help to adapt Formula syntax to work with Dynamic Named Ranges
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-28-2005, 08: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