LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Selecting objects

Mike,
If you are running this code from a button click, make sure its
..TakeFocusOnClick=False, otherwise you will always return a
Selection.Count=1, i.e. the button.

NickHK

"Mike" wrote in message
...
Seems easy enough, but does not seem to be working. I have this:

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

Does not seem to understand Selection.Count

"Tom Ogilvy" wrote:

Your trying to see if multiple objects are selected

Demo'd from the immediate window:
? selection.count
3
? selection(1).Name
Rectangle 6
? selection(2).Name
Oval 7

so use
if selection.count 1 then
' multiple objects selected

--
regards,
Tom Ogilvy



"Mike" wrote:

If the user has multiple objects selected, I want to do something. If

you
have one object selected, and use Selection.Name it gives the name of

the
object. If you have multiple objects selected, it gives an error. So I
thought I could do this:

If Selection.Name Is Error Then (do whatever)

But it doesn't work. Any ideas?





 
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
Excel 2007: Selecting multiple objects by drawing a selection box panalysis Excel Discussion (Misc queries) 4 April 2nd 23 07:41 PM
Selecting objects for deletion in 2007 Squeaky Excel Discussion (Misc queries) 7 May 5th 09 10:12 PM
selecting multiple objects with macro Memphus01 Excel Discussion (Misc queries) 3 December 2nd 08 07:30 PM
Stopping mouse selecting chart objects speedelectric Charts and Charting in Excel 0 June 16th 08 06:07 PM
Selecting drawing objects or shapes in a macro John DeFiore Excel Programming 3 October 13th 03 02:26 PM


All times are GMT +1. The time now is 12:34 AM.

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"