ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   finding empty selection (https://www.excelbanter.com/excel-programming/345254-finding-empty-selection.html)

Chimanrao

finding empty selection
 
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro


Tom Ogilvy

finding empty selection
 
if application.counta(selection) = 0 then

would be a start. Cells can't contain charts, so I don't see that as an
issue.

--
Regards,
Tom Ogilvy


"Chimanrao" wrote in message
oups.com...
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro




Nigel

finding empty selection
 
Take a look at IsEmpty or IsNull as a way to determine presence of content
in a Cell e.g.

If IsEmpty(Range("A1")) then MsgBox "A1 is Empty"

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro




Tom Ogilvy

finding empty selection
 
Just some added information:

IsNull has no play in this situation that I can see.

IsEmpty is only pertinent to a single cell (selection can be multiple cells
and the OP does say cells with an s) - So a loop might be required to use
IsEmpty

--
Regards,
Tom Ogilvy

"Nigel" wrote in message
...
Take a look at IsEmpty or IsNull as a way to determine presence of

content
in a Cell e.g.

If IsEmpty(Range("A1")) then MsgBox "A1 is Empty"

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro






Nigel

finding empty selection
 
Agreed Tom, I was building on your example to show another method albeit for
Cell (singular without the s).

IsNull was a nonsense suggestion I agree !
--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
Just some added information:

IsNull has no play in this situation that I can see.

IsEmpty is only pertinent to a single cell (selection can be multiple

cells
and the OP does say cells with an s) - So a loop might be required to

use
IsEmpty

--
Regards,
Tom Ogilvy

"Nigel" wrote in message
...
Take a look at IsEmpty or IsNull as a way to determine presence of

content
in a Cell e.g.

If IsEmpty(Range("A1")) then MsgBox "A1 is Empty"

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro








Andy Ives[_2_]

finding empty selection
 
You could also try the specialcells method. For example

Range("A1:A10").SpecialCells(xlCellTypeBlanks).Add ress

returns the adresses of the blanks within the range a1:a10

Cheers

Andy

"Nigel" wrote:

Agreed Tom, I was building on your example to show another method albeit for
Cell (singular without the s).

IsNull was a nonsense suggestion I agree !
--
Cheers
Nigel



"Tom Ogilvy" wrote in message
...
Just some added information:

IsNull has no play in this situation that I can see.

IsEmpty is only pertinent to a single cell (selection can be multiple

cells
and the OP does say cells with an s) - So a loop might be required to

use
IsEmpty

--
Regards,
Tom Ogilvy

"Nigel" wrote in message
...
Take a look at IsEmpty or IsNull as a way to determine presence of

content
in a Cell e.g.

If IsEmpty(Range("A1")) then MsgBox "A1 is Empty"

--
Cheers
Nigel



"Chimanrao" wrote in message
oups.com...
how do I find out if the selected cells have no content ie. no text,
charts, links etc?

Chimanro









Chimanrao

finding empty selection
 
You can select the background cells of a chart and press ctrl + c and
the chart also gets copied.
When I do GetSelection() in this case I get a Range object. In this
case all the cells can be empty but a chart object does exist in the
selection.

The the second scenario is when the user selects the chart object by
clicking on it. In this case when I use GetSelection i get a object but
its not of type range. which type is this object of?



All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com