ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dropdown issue (https://www.excelbanter.com/excel-programming/430159-dropdown-issue.html)

sunilpatel

dropdown issue
 

Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil



Patrick Molloy

dropdown issue
 

dropdown is for the user to select an item, but that clearly isn't required.
You don't say clearly what it is you intend

Sub combodrop()
With ActiveSheet.ComboBox1
.Visible = True
.AddItem "hello"
.ListIndex = .ListCount - 1
.Visible = False
End With

End Sub


"sunilpatel" wrote in message
...
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but if
.dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil


Leith Ross[_778_]

dropdown issue
 


sunilpatel;389250 Wrote:
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the
dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but
if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on
this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil


Hello Sunil,

I used the code below in both Excel 2000 and 2003 with no problems. It
is basically the same as yours. Try it out. If it doesn't work then
there is problem somewhere else.

Sub combodrop()
With ActiveSheet.ComboBox1
Visible = True
Clear
AddItem "Test 1"
AddItem "Test 2"
AddItem "Test 3"
DropDown
Visible = False
End With
End Sub

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=108818


Patrick Molloy

dropdown issue
 

Hi. you must have the . before each method/property if you use WITH

Sub combodrop()
With ActiveSheet.ComboBox1
.Visible = True
.Clear
.AddItem "Test 1"
.AddItem "Test 2"
.AddItem "Test 3"
.DropDown
.Visible = False
End With
End Sub


"Leith Ross" wrote in message
...

sunilpatel;389250 Wrote:
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the
dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but
if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on
this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil


Hello Sunil,

I used the code below in both Excel 2000 and 2003 with no problems. It
is basically the same as yours. Try it out. If it doesn't work then
there is problem somewhere else.

Sub combodrop()
With ActiveSheet.ComboBox1
Visible = True
Clear
AddItem "Test 1"
AddItem "Test 2"
AddItem "Test 3"
DropDown
Visible = False
End With
End Sub

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.thecodecage.com/forumz/member.php?userid=75
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=108818


sunilpatel

dropdown issue
 

Thankyou. but when i run this code, the combobox dissapears as expected, but
the dropdown list (test 1 ....test 3) remains on screen !!!
Maybe i should try on another computer hey?

Sunil
"Patrick Molloy" wrote in message
...
Hi. you must have the . before each method/property if you use WITH

Sub combodrop()
With ActiveSheet.ComboBox1
.Visible = True
.Clear
.AddItem "Test 1"
.AddItem "Test 2"
.AddItem "Test 3"
.DropDown
.Visible = False
End With
End Sub


"Leith Ross" wrote in message
...

sunilpatel;389250 Wrote:
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the
dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but
if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on
this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil


Hello Sunil,

I used the code below in both Excel 2000 and 2003 with no problems. It
is basically the same as yours. Try it out. If it doesn't work then
there is problem somewhere else.

Sub combodrop()
With ActiveSheet.ComboBox1
Visible = True
Clear
AddItem "Test 1"
AddItem "Test 2"
AddItem "Test 3"
DropDown
Visible = False
End With
End Sub

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.thecodecage.com/forumz/member.php?userid=75
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=108818




Patrick Molloy

dropdown issue
 

drop the
..Dropdown
line

"sunilpatel" wrote in message
...
Thankyou. but when i run this code, the combobox dissapears as expected,
but the dropdown list (test 1 ....test 3) remains on screen !!!
Maybe i should try on another computer hey?

Sunil
"Patrick Molloy" wrote in message
...
Hi. you must have the . before each method/property if you use WITH

Sub combodrop()
With ActiveSheet.ComboBox1
.Visible = True
.Clear
.AddItem "Test 1"
.AddItem "Test 2"
.AddItem "Test 3"
.DropDown
.Visible = False
End With
End Sub


"Leith Ross" wrote in message
...

sunilpatel;389250 Wrote:
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the
dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click, but
if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on
this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil

Hello Sunil,

I used the code below in both Excel 2000 and 2003 with no problems. It
is basically the same as yours. Try it out. If it doesn't work then
there is problem somewhere else.

Sub combodrop()
With ActiveSheet.ComboBox1
Visible = True
Clear
AddItem "Test 1"
AddItem "Test 2"
AddItem "Test 3"
DropDown
Visible = False
End With
End Sub

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.thecodecage.com/forumz/member.php?userid=75
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=108818




sunilpatel

dropdown issue
 

but that is what i want. i want the list to be dropped down when a certain
action is taken.

Sunil
"Patrick Molloy" wrote in message
...
drop the
.Dropdown
line

"sunilpatel" wrote in message
...
Thankyou. but when i run this code, the combobox dissapears as expected,
but the dropdown list (test 1 ....test 3) remains on screen !!!
Maybe i should try on another computer hey?

Sunil
"Patrick Molloy" wrote in message
...
Hi. you must have the . before each method/property if you use WITH

Sub combodrop()
With ActiveSheet.ComboBox1
.Visible = True
.Clear
.AddItem "Test 1"
.AddItem "Test 2"
.AddItem "Test 3"
.DropDown
.Visible = False
End With
End Sub


"Leith Ross" wrote in message
...

sunilpatel;389250 Wrote:
Sorry, as I have asked this question before, but can no one help me?
Having tried everything i can think of, i'm realy frustrated now.

In my code i use .dropdown (dot dropdown) , but then i wish the
dropdown
list to 'close' once an item in the list has been selected.
This behaves as expected if combobox is activated by a mouse click,
but
if
..dropdown is used the dropdown list does not close.

I realy need a work around or something as my code relies heavily on
this
process.

Please help - using excel 2000

Sub combodrop()
ActiveSheet.ComboBox1.Visible = True
ActiveSheet.ComboBox1.AddItem "TEST"
ActiveSheet.ComboBox1.DropDown
ActiveSheet.ComboBox1.Visible = False
End Sub

Sunil

Hello Sunil,

I used the code below in both Excel 2000 and 2003 with no problems. It
is basically the same as yours. Try it out. If it doesn't work then
there is problem somewhere else.

Sub combodrop()
With ActiveSheet.ComboBox1
Visible = True
Clear
AddItem "Test 1"
AddItem "Test 2"
AddItem "Test 3"
DropDown
Visible = False
End With
End Sub

Sincerely,
Leith Ross


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.thecodecage.com/forumz/member.php?userid=75
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=108818







All times are GMT +1. The time now is 12:23 PM.

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