+ Reply to Thread
Results 1 to 5 of 5

Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

  1. #1
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

    I was hoping to be able to do something like the following to select visible and non-blank cells, but not sure if it's possible or what the right syntax is. I'm aware I could just set the visible cells and then check if each has a value (or vice versa), but was hoping this would work. Neither of these do.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

    Please Login or Register  to view this content.
    seems to work for me with constants. Does the non-blank cells contain formulas?

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

    Both of these worked for me.

    Please Login or Register  to view this content.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

    See if this VBA code adds any clarity to your issue:
    Please Login or Register  to view this content.
    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Using SpecialCells to set a range of cells that are BOTH visible and non-blank?

    Thanks everyone, you're all correct. That syntax does work.

    Turns out there is a difference between cell values of "" and cell values of Empty. SpecialCells(2) will include cell values of "", which I don't want.

    So I just included code to change "" to Empty, and now it works as expected. Here's the code for anyone interested.

    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. Trying to add text to the end of non-blank cells using SpecialCells
    By fallwire in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2015, 08:07 AM
  2. [SOLVED] Ignore blank cells and read only visible cells
    By DEB1000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-05-2015, 07:47 PM
  3. [SOLVED] How to find the ROW of the blank cells with .SpecialCells(xlCellTypeBlanks)
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 07-08-2014, 01:20 PM
  4. Creating array of specialcells(visible) returns only first x cells
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-27-2013, 11:04 AM
  5. [SOLVED] SpecialCells(xlCellTypeVisible) Not Returning Visible Cells Resulting from AutoFilter
    By Filibuster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2012, 05:48 AM
  6. Count blank visible cells under filter
    By digita in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2010, 06:18 PM
  7. Deleting blank rows using loop and SpecialCells
    By mcraewhite in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2008, 05:42 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