PC Review


Reply
Thread Tools Rate Thread

adding ComboBox programitacally

 
 
greg
Guest
Posts: n/a
 
      18th Jun 2007
Hello,
I am struggling a little.
I see you can add a CheckBox by doing this:
With ActiveSheet.CheckBoxes.Add(Range(objRange.Address).Left +
Range(objRange.Address).width / 2 - 6, _
Range(objRange.Address).Top + Range(objRange.Address).height / 2 -
10, 15, 25)

However I am trying to build a combobox.

I have been trying a bunch of things
such as:

Dim objSheet As Excel.Worksheet
Set objSheet = Excel.ActiveSheet
Dim objRange As Excel.Range
Set objRange = Range("$F$10")

objSheet.ComboBoxes.Add ....

etc....

can anyone help on creating a combo box.
in a specific range area?
thanks


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      18th Jun 2007
I don't know about your calculations/measurements, but this will put in a
combobox (dropdown box) from the forms toolbar:

Sub aAA()
Set objRange = Range("J13")
With ActiveSheet.DropDowns.Add( _
Range(objRange.Address).Left + _
Range(objRange.Address).Width / 2 - 6, _
Range(objRange.Address).Top + _
Range(objRange.Address).Height / 2 - 10, 15, 25)
End With
End Sub

--
Regards,
Tom Ogilvy


"greg" wrote:

> Hello,
> I am struggling a little.
> I see you can add a CheckBox by doing this:
> With ActiveSheet.CheckBoxes.Add(Range(objRange.Address).Left +
> Range(objRange.Address).width / 2 - 6, _
> Range(objRange.Address).Top + Range(objRange.Address).height / 2 -
> 10, 15, 25)
>
> However I am trying to build a combobox.
>
> I have been trying a bunch of things
> such as:
>
> Dim objSheet As Excel.Worksheet
> Set objSheet = Excel.ActiveSheet
> Dim objRange As Excel.Range
> Set objRange = Range("$F$10")
>
> objSheet.ComboBoxes.Add ....
>
> etc....
>
> can anyone help on creating a combo box.
> in a specific range area?
> thanks
>
>
>

 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      18th Jun 2007
thanks,
looks good


"Tom Ogilvy" <(E-Mail Removed)> wrote in message
news6D8A497-C609-4727-ADE7-(E-Mail Removed)...
> I don't know about your calculations/measurements, but this will put in a
> combobox (dropdown box) from the forms toolbar:
>
> Sub aAA()
> Set objRange = Range("J13")
> With ActiveSheet.DropDowns.Add( _
> Range(objRange.Address).Left + _
> Range(objRange.Address).Width / 2 - 6, _
> Range(objRange.Address).Top + _
> Range(objRange.Address).Height / 2 - 10, 15, 25)
> End With
> End Sub
>
> --
> Regards,
> Tom Ogilvy
>
>
> "greg" wrote:
>
> > Hello,
> > I am struggling a little.
> > I see you can add a CheckBox by doing this:
> > With ActiveSheet.CheckBoxes.Add(Range(objRange.Address).Left +
> > Range(objRange.Address).width / 2 - 6, _
> > Range(objRange.Address).Top + Range(objRange.Address).height /

2 -
> > 10, 15, 25)
> >
> > However I am trying to build a combobox.
> >
> > I have been trying a bunch of things
> > such as:
> >
> > Dim objSheet As Excel.Worksheet
> > Set objSheet = Excel.ActiveSheet
> > Dim objRange As Excel.Range
> > Set objRange = Range("$F$10")
> >
> > objSheet.ComboBoxes.Add ....
> >
> > etc....
> >
> > can anyone help on creating a combo box.
> > in a specific range area?
> > thanks
> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re:adding empty row to combobox k magableh Microsoft Dot NET Framework Forms 0 31st Dec 2005 02:00 PM
Adding Item to ComboBox Christopher Weaver Microsoft C# .NET 2 5th Aug 2005 04:36 PM
Adding a value to a ComboBox =?Utf-8?B?SGVybWlvbmU=?= Microsoft Access Form Coding 3 1st Dec 2004 10:25 PM
Re: Adding Images to ComboBox Supra Microsoft Dot NET Framework Forms 0 29th Jul 2004 02:19 PM
Adding itens into a combobox Marco Roberto Microsoft VB .NET 1 12th Nov 2003 08:52 PM


Features
 

Advertising
 

Newsgroups
 


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