+ Reply to Thread
Results 1 to 3 of 3

Can the CountA range be a variable?

  1. #1
    Registered User
    Join Date
    02-16-2012
    Location
    Atlanta, Georgia, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Can the CountA range be a variable?

    I'm trying to identify ranges that contain a certain number of non-blank cells and take some action if that number is certain value.
    Here's an example: I've written this several ways but I can't get the CountA range to accept a variable.
    Is this possible?

    Please Login or Register  to view this content.
    Last edited by Richard2012; 02-16-2012 at 01:53 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-16-2004
    Location
    Canada, Quebec
    Posts
    363

    Re: Can the CountA range be a variable?

    Not to pretty but should do the job, I am still looking why it does work, if I find something will report back

    Please Login or Register  to view this content.
    Denis

    Please always attach the sample workbook without sensitive information when asking for help

    To add a module
    Press Alt + F11 (this is the Visual Basic Environment)
    Insert Menu, select Module
    Past code there
    Close Visual Basic Environment (X)

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Can the CountA range be a variable?

    The issue stems from the fact that the CountA function is expecting a Range object, but when you concatenate "Block" with the variable "i" you're creating a String. Simply wrapping Range() around it doesn't convert it to an actual range, either, as no named range exists in the workbook (only in the code itself).

    Perhaps try:
    Please Login or Register  to view this content.
    Change your sheet name and ranges as necessary.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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