ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count selected Objects (https://www.excelbanter.com/excel-programming/360362-count-selected-objects.html)

Mike

Count selected Objects
 
I have simplified this issue.

I have several objects selected, and I want vb code to return the number of
selected objects. Any dieas?

Mike

Count selected Objects
 
I have this:

Selection.Count
If Selection.Count 1 Then
GoTo MultipleObjects
Else
End If

Does not seem to understand Selection.Count


"Mike" wrote:

I have simplified this issue.

I have several objects selected, and I want vb code to return the number of
selected objects. Any dieas?


Tom Ogilvy

Count selected Objects
 
It won't understand selection.count if only one shape is selected. So:

Dim s as String
on Error resume Next
s = selection.Name
On error goto 0
if s = "" then
goto Multiple
else
' only one selected
end if

--
regards,
Tom Ogilvy


"Mike" wrote:

I have this:

Selection.Count
If Selection.Count 1 Then
GoTo MultipleObjects
Else
End If

Does not seem to understand Selection.Count


"Mike" wrote:

I have simplified this issue.

I have several objects selected, and I want vb code to return the number of
selected objects. Any dieas?



All times are GMT +1. The time now is 08:57 PM.

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