Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default What has the User selected?


Hello ever helpful people,
If a user selects a range in a sheet, is it possible to determine if he has
selected a range of cells or an entire row or column?

I have tried naieve things like
for each mycell in selection
if mycell.selection.entrierow = true then ...

but no luck.
Any help please?

many thanks,
Bony
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default What has the User selected?


If Selection.cells.count = columns.count And selection.rows.count=1 Then
'1 full Row selected

If selection.rows.count = rows.count And selection.columns.count=1 then
'1 full Column selected

In 2007 you need to use .CountLarge

If this post helps click Yes
---------------
Jacob Skaria


"Bony Pony" wrote:

Hello ever helpful people,
If a user selects a range in a sheet, is it possible to determine if he has
selected a range of cells or an entire row or column?

I have tried naieve things like
for each mycell in selection
if mycell.selection.entrierow = true then ...

but no luck.
Any help please?

many thanks,
Bony

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default What has the User selected?


The code is correct. When myrange.Rows.Count = Rows.Count indicates the
entire column is selected. Same applies for entire row.


Set myrange = Selection
MsgBox (myrange.Address)
MsgBox (myrange.Rows.Count)
MsgBox (myrange.Columns.Count)

If myrange.Rows.Count = Rows.Count Then
MsgBox ("entire column is selected")
End If

If myrange.Columns.Count = Columns.Count Then
MsgBox ("entire row is selected")
End If

"Bony Pony" wrote:

Hello ever helpful people,
If a user selects a range in a sheet, is it possible to determine if he has
selected a range of cells or an entire row or column?

I have tried naieve things like
for each mycell in selection
if mycell.selection.entrierow = true then ...

but no luck.
Any help please?

many thanks,
Bony

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default What has the User selected?


Hi Joel / Jacob,

Many thanks! As always, the answer within Excel is to think laterally and
keep it simple,

Kind regards,
Bony

"Bony Pony" wrote:

Hello ever helpful people,
If a user selects a range in a sheet, is it possible to determine if he has
selected a range of cells or an entire row or column?

I have tried naieve things like
for each mycell in selection
if mycell.selection.entrierow = true then ...

but no luck.
Any help please?

many thanks,
Bony

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default What has the User selected?


Hi Jacob,
Thanks for the countlarge tip ...

Kind regards,
Bony

"Jacob Skaria" wrote:

If Selection.cells.count = columns.count And selection.rows.count=1 Then
'1 full Row selected

If selection.rows.count = rows.count And selection.columns.count=1 then
'1 full Column selected

In 2007 you need to use .CountLarge

If this post helps click Yes
---------------
Jacob Skaria


"Bony Pony" wrote:

Hello ever helpful people,
If a user selects a range in a sheet, is it possible to determine if he has
selected a range of cells or an entire row or column?

I have tried naieve things like
for each mycell in selection
if mycell.selection.entrierow = true then ...

but no luck.
Any help please?

many thanks,
Bony

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
User Selected Month Loopi Excel Programming 5 February 4th 09 12:50 AM
How to: User selected range? Phil Smith Excel Programming 7 December 19th 08 08:41 PM
How to sort on the row selected by user? -JEFF-[_2_] Excel Programming 0 September 21st 05 07:36 PM
Checking to see if user selected an Option Kirk[_2_] Excel Programming 1 August 27th 03 09:46 PM
How to find out what the user selected? Mike[_31_] Excel Programming 0 July 24th 03 11:02 AM


All times are GMT +1. The time now is 05:22 AM.

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

About Us

"It's about Microsoft Excel"