+ Reply to Thread
Results 1 to 2 of 2

Code That Selects all non blank cells...Clarification needed.

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    491

    Code That Selects all non blank cells...Clarification needed.

    Hello

    below is the following code that I am having confusion with understanding

    Please Login or Register  to view this content.
    This code selects all the non blank cells in the active worksheet...
    But as you can see in my comment, I do not understand why this code has the number 23 in it.
    and further more, Why is it using the union approach?

    Will this work for any range of data?
    What if I wanted to do the reverse and select all the blank cells or cells with specific criteria? Where in this code would I make those adjustments?

    Attached is my spreadsheet where I just entered letters into random text in different cells on sheet1 to verify the code work.

    Any elaboration on this what seems to be important code would be of great help.

    Thank You!
    Attached Files Attached Files

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

    Re: Code That Selects all non blank cells...Clarification needed.

    Hi, swade730,

    both formulas and constants have certain values assigned:
    xlErrors 16
    xlLogical 4
    xlNumbers 1
    xlTextValues 2
    If you add up the values you will get - ?

    Union is for both kind of cells which may be listed in a worksheet: formulas and constants. The unions makes it one big range to work on.

    xlCellTypeBlanks is only for empty cells.

    Maybe install the VBA help or have a look at the Object Browser for more info on these constants.

    Ciao,
    Holger
    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

+ 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] VBA code needed to add auto serial number, delete blank row & merge cells
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-28-2021, 06:50 AM
  2. Code selects entire rows upto one range and same code selects only columns for other.
    By sriharigk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2012, 05:19 AM
  3. Replies: 1
    Last Post: 02-24-2012, 07:14 AM
  4. Need macro that finds and selects blank cells in col A, pastes shape in all
    By salvator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2011, 01:12 PM
  5. Excel 2007 : Selects blank cells
    By desertdude1 in forum Excel General
    Replies: 1
    Last Post: 01-29-2009, 05:29 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