Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Move a single combo box from one cell to another...

This has probablly been answered before but does anyone have any sample code
show how I would go about moving the locaiton of a combo box dependent on
where the user clicks. I know it's probablly going to involve the
SelectionChange event of the worksheet but I can't seem to get the combo to
display in the new location.
Sample code to follow::::

if (cbo1 != null)
{
Globals.Sheet1.Controls.Remove(cbo1);
cbo1 = null;
}
selection = Target ;
cbo1 =
(Microsoft.Office.Tools.Excel.Controls.ComboBox)Gl obals.Sheet1.OLEObjects(name);
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1, selection,
name);
cbo1.Name = name;
cbo1.Activate();


Thanks in advance..
Jimm
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Move a single combo box from one cell to another...

Hi Jimm,

See Debra Dagleish's code and detailed
instructions at:


http://www.contextures.com/xlDataVal10.html

The above ComboBox is intended for
Data Validation but should answer all
of the problems that you raise.



---
Regards.
Norman


"Jimm" wrote in message
...
This has probablly been answered before but does anyone have any sample
code
show how I would go about moving the locaiton of a combo box dependent on
where the user clicks. I know it's probablly going to involve the
SelectionChange event of the worksheet but I can't seem to get the combo
to
display in the new location.
Sample code to follow::::

if (cbo1 != null)
{
Globals.Sheet1.Controls.Remove(cbo1);
cbo1 = null;
}
selection = Target ;
cbo1 =
(Microsoft.Office.Tools.Excel.Controls.ComboBox)Gl obals.Sheet1.OLEObjects(name);
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1, selection,
name);
cbo1.Name = name;
cbo1.Activate();


Thanks in advance..
Jimm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Move a single combo box from one cell to another...

Thanks - I've looked at Debra's code and gleaned what I can to do it in C#
but the problem I seem to be running into is that I'm unable to create a
combo box at runtime in the "SelectionChange" event.

This code run in the Sheet "StartUp" event works and create a combo and
displays it...

selection = Globals.ThisWorkbook.Application.get_Range("H5",
"H5");
cbo1 = new Microsoft.Office.Tools.Excel.Controls.ComboBox();
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1, selection,
name);
cbo1.Name = name;

the identical code in the "SelectionChange" event does not work. Any thoughts?

Jimm

"Norman Jones" wrote:

Hi Jimm,

See Debra Dagleish's code and detailed
instructions at:


http://www.contextures.com/xlDataVal10.html

The above ComboBox is intended for
Data Validation but should answer all
of the problems that you raise.



---
Regards.
Norman


"Jimm" wrote in message
...
This has probablly been answered before but does anyone have any sample
code
show how I would go about moving the locaiton of a combo box dependent on
where the user clicks. I know it's probablly going to involve the
SelectionChange event of the worksheet but I can't seem to get the combo
to
display in the new location.
Sample code to follow::::

if (cbo1 != null)
{
Globals.Sheet1.Controls.Remove(cbo1);
cbo1 = null;
}
selection = Target ;
cbo1 =
(Microsoft.Office.Tools.Excel.Controls.ComboBox)Gl obals.Sheet1.OLEObjects(name);
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1, selection,
name);
cbo1.Name = name;
cbo1.Activate();


Thanks in advance..
Jimm


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Move a single combo box from one cell to another...

Hi Jimm,

The indicated code does not create a
ComboBox in the SelectionChange event:
the code shows or hides a previously
created ComboBox.

Therefore, it should suffice to create the
ComboBox programmatically and then
use techniques similar to those employed
by Debra to hide / unhide the ComboBox
in the SelectionChange event.


---
Regards.
Norman


"Jimm" wrote in message
...
Thanks - I've looked at Debra's code and gleaned what I can to do it in C#
but the problem I seem to be running into is that I'm unable to create a
combo box at runtime in the "SelectionChange" event.

This code run in the Sheet "StartUp" event works and create a combo and
displays it...

selection = Globals.ThisWorkbook.Application.get_Range("H5",
"H5");
cbo1 = new Microsoft.Office.Tools.Excel.Controls.ComboBox();
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1, selection,
name);
cbo1.Name = name;

the identical code in the "SelectionChange" event does not work. Any
thoughts?

Jimm

"Norman Jones" wrote:

Hi Jimm,

See Debra Dagleish's code and detailed
instructions at:


http://www.contextures.com/xlDataVal10.html

The above ComboBox is intended for
Data Validation but should answer all
of the problems that you raise.



---
Regards.
Norman


"Jimm" wrote in message
...
This has probablly been answered before but does anyone have any sample
code
show how I would go about moving the locaiton of a combo box dependent
on
where the user clicks. I know it's probablly going to involve the
SelectionChange event of the worksheet but I can't seem to get the
combo
to
display in the new location.
Sample code to follow::::

if (cbo1 != null)
{
Globals.Sheet1.Controls.Remove(cbo1);
cbo1 = null;
}
selection = Target ;
cbo1 =
(Microsoft.Office.Tools.Excel.Controls.ComboBox)Gl obals.Sheet1.OLEObjects(name);
cbo1.Tag = Globals.Sheet1.Controls.AddControl(cbo1,
selection,
name);
cbo1.Name = name;
cbo1.Activate();


Thanks in advance..
Jimm



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
Wanting to move single lines to second worksheet CP Excel Discussion (Misc queries) 6 May 23rd 07 05:28 AM
Cannot select single cell. Mouse move automatically creates range. Dave Jones - England Excel Discussion (Misc queries) 1 April 22nd 07 09:37 AM
Can't highlight a single cell. Creates a range when I move curso Butch Walker Excel Worksheet Functions 4 July 6th 06 07:48 PM
move data to a single cell and at the same same time filter the da Ann Excel Discussion (Misc queries) 1 April 4th 05 02:47 PM
Move Different Columns of Data to Single Column. willik Excel Programming 2 February 27th 04 01:42 PM


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