#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Selection

Hello,
How can I tell if an entire column has been selected or just a few cells in
the column?

Thanks,

Bill


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selection

Just a single column?

if selection.address = selection.cells(1).entirecolumn.address then
'whole column
else
'not whole column
end if



Bill wrote:

Hello,
How can I tell if an entire column has been selected or just a few cells in
the column?

Thanks,

Bill


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Selection

Thanks Dave,
It could be multiple columns as well.

Bill
"Dave Peterson" wrote in message
...
Just a single column?

if selection.address = selection.cells(1).entirecolumn.address then
'whole column
else
'not whole column
end if



Bill wrote:

Hello,
How can I tell if an entire column has been selected or just a few cells
in
the column?

Thanks,

Bill


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selection

if selection.address = selection.entirecolumn.address then



Bill wrote:

Thanks Dave,
It could be multiple columns as well.

Bill
"Dave Peterson" wrote in message
...
Just a single column?

if selection.address = selection.cells(1).entirecolumn.address then
'whole column
else
'not whole column
end if



Bill wrote:

Hello,
How can I tell if an entire column has been selected or just a few cells
in
the column?

Thanks,

Bill


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Selection

Bill,

How about calling this, once your cells are selected?

Sub IsItAColumn()

Dim CountCell As Range
Dim Count As Long

For Each CountCell In Selection
Count = Count + 1
Next
If Count = 65536 Then
MsgBox ("You've selected the entire column")
Else
MsgBox ("You've just selected cells")
End If
End Sub

Mind you, you might need to make it a bit more clever if you selected (for
example)8 columns by 8192 rows, which equates to the same thing i.e. 65536

Hope this helps

Pete

"Bill" wrote:

Hello,
How can I tell if an entire column has been selected or just a few cells in
the column?

Thanks,

Bill





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Object Type of a selection... counting rows in a selection Acid-Sky[_2_] Excel Programming 3 August 23rd 05 09:53 AM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"