Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

Hello,

I tried to find ,whether this was discussed before,but couldn't find
anything.I will be thankful for any ideas.
I have a task related to transformation of Excel to XML.
And I encounter this specific problem:
I have coulpe of listboxes (created from the Forms toolbar,bot ActiveX
controls).

My problem is to find out ,in which cell is positioned each listbox.
The list boxes are not linked to cells.But rather I need the cell
,where they are positioned.

In general it will be also a solution for me if I can get the listboxes
positioned in a given cell ..let's say for example in cell A1.

I try with :
Range("A1").Activate
MsgBox "Selected index " & _
Selection.ShapeRange(1).ControlFormat.ListIndex

But it seems this is not the correct way.

What I notice is that a List Box is assigne more or less to the
cell,where the left corner of the listbox is.At least the listbox moves
by default with this cell.

Is it possible for example to select a range within the sheet and then
to get all shapes,positioned in the range.That would solve my problem.

Thanks in advance ..
Any ideas are welcomed

Best regards

Vlado

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

Sorry ,just to clarify...the listboxes are not ActiveX list boxes.They
are simple Excel controls.(If this has any meaning to the question)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

for each bx in Activesheet.listboxes
msgbox bx.TopLeftCell.Address
next

--
Regards,
Tom Ogilvy


"vlado_varna" wrote in message
oups.com...
Sorry ,just to clarify...the listboxes are not ActiveX list boxes.They
are simple Excel controls.(If this has any meaning to the question)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

Wow Tom..thanks a lot...
I was looking for this in microsoft MSDN ,but couldn't find it...
GREAT .Thanks a lot!! This completely helps me to implemnt,what I need.

Just for information,because it is interesting to me:
I see,that I can use this to make it in the oppsoite direction...e.g If
I have a cell H10 for example....to check ,if there are listboxes in
the cell...but first I have to loop through all listboxes in the
sheet...is it possible to avoid this?
Suppose ,you want to get all forms,that are position in H11..let's say
listboxed...combo boxes...buttons....
is there a straight forward method for this?

Kind regards

Vlado

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

Nothing built in comes to mind. If you have xl2002 or later (I think this
was introduced in xl2002) you can possibly cobble something together using

RangeFromPoint

See the Excel VBA help for details.

But looping doesn't seem to be that big of a deal to me. You could loop the
shapes collection and test the type of shape.

--
Regards,
Tom Ogilvy

"vlado_varna" wrote in message
oups.com...
Wow Tom..thanks a lot...
I was looking for this in microsoft MSDN ,but couldn't find it...
GREAT .Thanks a lot!! This completely helps me to implemnt,what I need.

Just for information,because it is interesting to me:
I see,that I can use this to make it in the oppsoite direction...e.g If
I have a cell H10 for example....to check ,if there are listboxes in
the cell...but first I have to loop through all listboxes in the
sheet...is it possible to avoid this?
Suppose ,you want to get all forms,that are position in H11..let's say
listboxed...combo boxes...buttons....
is there a straight forward method for this?

Kind regards

Vlado





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can I determine in which cell is a listbox postioned?Or how to get the listboxes in a certain cell?

Tom,Thanks again!!!
Kind regards and all the best!!

Vlado

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
Determine size of listbox Jasper Excel Discussion (Misc queries) 3 April 18th 06 10:38 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM
Function to determine if any cell in a range is contained in a given cell [email protected] Excel Worksheet Functions 3 February 7th 05 04:19 PM
Wanted func to determine height of ListBox row count Excel Programming 2 May 24th 04 06:38 PM
I need to determine a cell range based on a blank cell Katrina Excel Programming 1 July 3rd 03 09:11 PM


All times are GMT +1. The time now is 09:10 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"