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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com