+ Reply to Thread
Results 1 to 6 of 6

Dynamic Range VBA question

  1. #1
    Registered User
    Join Date
    06-09-2014
    Posts
    10

    Dynamic Range VBA question

    Hello,

    I have a question about programming dynamic ranges in VBA. I have 5 columns with a variety of different input types, including text, date and numbers. At the bottom of the list, I have two cells (separated by two blank rows) that contain subtotal and sum formulas, as well as labels, as a means of checking and filtering the data. I have set up dynamic ranges in my current program with the following code:

    Please Login or Register  to view this content.
    The problem is that this code includes the subtotal and sum values in the range, and I do not need them to be included. How can I adjust my code to exclude these values and include only the "data"? I have attached a file to help visualize my dilemma.

    Thanks for your help.
    Attached Files Attached Files
    Last edited by bc012493; 06-09-2014 at 11:57 AM. Reason: code tags

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Dynamic Range VBA question

    Hi, bc012493,

    welcome to ExcelForum. Please be reminded to use code-tags whenever you post procedures here according to Forum Rule #3.

    Maybe use
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by HaHoBe; 06-09-2014 at 11:45 AM.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-09-2014
    Posts
    10

    Re: Dynamic Range VBA question

    Thanks for your response Holger. Unfortunately this change did not produce the desired effect. I realized my original post does not include two "header" rows that exist in the documents I am actually working with. I have attached an updated version of the example file.

    Essentially, I am seeking a way to squeeze the dynamic range to be (Row 3:The last Row of data, excluding the subtotal/total calculations)

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Dynamic Range VBA question

    Hi, bc012493,

    this is one of the rare cases where you either choose not to work with the last column ij the area as there are additional lines after the area you want to work with or start from the top and go down:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    06-09-2014
    Posts
    10

    Re: Dynamic Range VBA question

    Holger,

    This worked! Thanks so much.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,562

    Re: Dynamic Range VBA question

    You have this already
    Please Login or Register  to view this content.
    What if you just change it to
    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. [SOLVED] Dynamic Range question
    By Woodchuck75 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-22-2012, 04:20 PM
  2. [SOLVED] Dynamic range question
    By Guy Normandeau in forum Excel General
    Replies: 13
    Last Post: 08-02-2006, 02:35 AM
  3. dynamic range question
    By Robin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2005, 07:05 PM
  4. Question regarding dynamic range setting
    By dharmik in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 09-06-2005, 03:05 PM
  5. Dynamic Range Question
    By Celt in forum Excel General
    Replies: 0
    Last Post: 02-08-2005, 11:27 AM

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