ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is column selected (https://www.excelbanter.com/excel-programming/306471-column-selected.html)

Josh Sale

Is column selected
 
Is there some simple way in VBA to tell if the user has selected an entire
column?

TIA

josh



William[_2_]

Is column selected
 
Hi Josh

MsgBox Selection.Rows.Count = ActiveSheet.Rows.Count

returns true if an entirecolumn is selected

--
XL2002
Regards

William



"Josh Sale" <jsale@tril dot cod wrote in message
...
| Is there some simple way in VBA to tell if the user has selected an entire
| column?
|
| TIA
|
| josh
|
|



Soo Cheon Jheong[_2_]

Is column selected
 
Hi,

Sub TEST()

If TypeName(Selection) = "Range" Then
If Selection.Areas.Count = 1 Then
If Selection.Areas(1).Rows.Count = Rows.Count Then
MsgBox "OK"
End If
End If
End If

End Sub


--
Regards,
Soo Cheon Jheong
_ _
^вп^
--




Josh Sale

Is column selected
 
William, Soo,

Thanks for the insight! I like it.

Thanks,

josh




All times are GMT +1. The time now is 11:52 AM.

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