Use Variables for Range in Macro

  • The following macro sorts columns A - F based on values in Columns B and D.

    I plan to use similar macros for other tabs in the same spreadsheet.

    The first row for each tab will be different and will vary as existing rows are deleted and/or new rows are added.

    I would like to have the references to A23, B23, D23 and F23 be variables.

    This will allow the values to be placed in a cell on each tab.

    Having the value in a cell will:

    Allow for changes to that value as changes are made to rows on the tab

    Eliminate the need to change the macro as changes are made to rows on the tab

    Thank you.

  • Welcome to Ozgrid. Please take a few minutes to read the Forum Rules, there' a link in my signature below. I have added code tags this time.

    An example workbook will make it easier to provide an answer.

  • The sort macro I provided does work and is set-up to sort not the recurring, but 'Other Transactions'; I only want to sort the 'Other Transactions', I do not want to sort 'Recurring Transactions'; I do not understand reference to Table Format; I realize I only provided the portion of the macro for Pending Debit transactions;

  • So what do you want to sort.

    If you don't understand about working with data in Excel and table formats I suggest you start to learn That would be more important than VBA if this is the type of work you are doing.

  • Try this

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!