+ Reply to Thread
Results 1 to 6 of 6

VBA to select values

  1. #1
    Registered User
    Join Date
    07-24-2011
    Location
    Covington, KY
    MS-Off Ver
    Excel 2007
    Posts
    3

    VBA to select values

    I have a macro that selects a range going down from A2 to the last row with values and the over right to the last column with values. The code selects all cells with formulas, even those returning no value leaving the cell blank. how do I change the macro to slect only the cells that have values returned and not those with only formulas entered. The last cell in column A with values is row A96 but this macro selects down to row 150 because there are formulas but no values present. Here is the macro:
    Please Login or Register  to view this content.
    Ken
    Last edited by Paul; 07-24-2011 at 09:10 PM. Reason: Added code tags

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: VBA to select values

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    07-24-2011
    Location
    Covington, KY
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA to select values

    Forgive me, I'm a newbie. Do I add this to the existing code or completely replace the existing? I've tried both ways and neither gets past this line.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: VBA to select values

    If you need to select the cells, add .Select to the end and replace your current code.

    In most cases, if not all, you do not need to select cells or ranges.

    I'd guess that's why snb didn't include it. ;-)

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    07-24-2011
    Location
    Covington, KY
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA to select values

    I get an error message that No cells found after replacing with this code.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: VBA to select values

    Please post a sample workbook.

    Regards

+ 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