+ Reply to Thread
Results 1 to 6 of 6

Highlight data set of variable size

  1. #1
    Registered User
    Join Date
    03-30-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    51

    Highlight data set of variable size

    Good morning. My apologies if this was already covered and I missed it.

    In my job, I have a report I get each day. The columns are always the same, but the rows are variable. They can be anywhere from 300 to 3000 (or more in extreme cases).

    I am looking to create a Macro that creates pivot tables out of the data. I've almost got it, but I admit I am a novice at VBA. So the question:

    How do I, using VBA, get Excel to select just the number of rows in the data set when that number varies from day to day?

    Each time I try using the record macro feature, Excel gives me specific cell references and that's no good.

    Thank you for taking the time to read. Know that your responses are appreciated.

    Thank you.

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

    Re: Highlight data set of variable size

    Set a variable range

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-30-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    51

    Re: Highlight data set of variable size

    Quote Originally Posted by davesexcel View Post
    Set a variable range

    Please Login or Register  to view this content.
    Good morning, Dave. (totally reading that in a Hal 9000 voice... *ahem* moving on)

    Thank you for your speedy reply. I have no doubt that what you posted is exactly what I need. However, I am still a novice. Can you give me a breakdown, please? I very much want to understand the code rather than just copy/paste it into a macro.

    Thanks again.

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

    Re: Highlight data set of variable size

    Sure thing, lets see your code, then we can edit it to work with the lines of code I provided, that finds the last row in column A and sets the range

  5. #5
    Registered User
    Join Date
    03-30-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    51

    Re: Highlight data set of variable size

    Quote Originally Posted by davesexcel View Post
    Sure thing, lets see your code, then we can edit it to work with the lines of code I provided, that finds the last row in column A and sets the range
    I very much appreciate your offer. And I fully understand that things in Excel are not copyrighted or anything like it. But my company frowns on things getting copied and pasted on the internet. I know... I know... it's just code. But it's not worth the risk.

    I will completely understand if you're disinclined to continue the explanation.

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

    Re: Highlight data set of variable size

    The information you have supplied is insufficient, I can only assume. The code I gave you finds the last row in column A and then sets the range from (A1:C and last row). Nothing more I can give you until you have supplied more information.
    If you are using your macro recorder, check out relative and absolute references to find the last row.

    Check out my site on selection codes as well.
    http://www.xlorate.com/selection-codes.html

+ 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] Size a range from the size of another in VBA variable
    By jayherring86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2015, 09:17 AM
  2. vlookup with variable range and variable array size
    By chaslie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2013, 02:37 PM
  3. Replies: 3
    Last Post: 01-05-2013, 03:09 PM
  4. Highlight email red is size is over certain KB
    By johncassell in forum Outlook Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2011, 04:09 AM
  5. Establishing a variable range based on data size
    By Bjordion in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-07-2011, 10:29 AM
  6. Establishing a variable range based on data size
    By Bjordion in forum Excel General
    Replies: 2
    Last Post: 10-05-2011, 04:57 PM
  7. posting variable size data from one tab to another
    By vondie in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-01-2008, 09:12 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