Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MVM MVM is offline
external usenet poster
 
Posts: 53
Default ComboBox methods in Excel VBA

I am having a combobox on a worksheet. I like to fill it in the
worksheet_open() function. In VBA how do i get these methods? - additem,
dataitem, list etc for combobox.

I declared a worksheet wb code in thisworkbook
--------------------
Option Explicit
Public DeptLocRange As Range, AcctRange As Range
Public ws As Worksheet
Private Sub Workbook_Open()
Dim r As Integer
Set ws = Me.Worksheets("Expenses")
With ws
Set DeptLocRange = .Range(.Cells(79, 3), .Cells(86, 6))
Set AcctRange = .Range(.Cells(91, 3), .Cells(92, 16))
r = 2
DeptLocRange.Select
' Worksheets("Expenses").cmbLocation.AddItem ("<select Loc")
' While Not IsNull(DeptLocRange(r, 1))
' .cmbLocation.AddItem = DeptLocRange(r, 1)
' Wend
' .cmbLocation.ListIndex = 0
' .cmbDepartment.ListIndex = 0
End With
Worksheets("Expenses").cmbLocation.ListIndex = 0
Worksheets("Expenses").cmbDepartment.ListIndex = 0
End Sub

--------------------
commented lines are not working. wb.cmbLocation.listindex won't work. but
the last two lines works. Any help is greatly appreciated.

Thanks
MVMurthy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default ComboBox methods in Excel VBA

You have some follow up questions at your other post.

MVM wrote:

I am having a combobox on a worksheet. I like to fill it in the
worksheet_open() function. In VBA how do i get these methods? - additem,
dataitem, list etc for combobox.

I declared a worksheet wb code in thisworkbook
--------------------
Option Explicit
Public DeptLocRange As Range, AcctRange As Range
Public ws As Worksheet
Private Sub Workbook_Open()
Dim r As Integer
Set ws = Me.Worksheets("Expenses")
With ws
Set DeptLocRange = .Range(.Cells(79, 3), .Cells(86, 6))
Set AcctRange = .Range(.Cells(91, 3), .Cells(92, 16))
r = 2
DeptLocRange.Select
' Worksheets("Expenses").cmbLocation.AddItem ("<select Loc")
' While Not IsNull(DeptLocRange(r, 1))
' .cmbLocation.AddItem = DeptLocRange(r, 1)
' Wend
' .cmbLocation.ListIndex = 0
' .cmbDepartment.ListIndex = 0
End With
Worksheets("Expenses").cmbLocation.ListIndex = 0
Worksheets("Expenses").cmbDepartment.ListIndex = 0
End Sub

--------------------
commented lines are not working. wb.cmbLocation.listindex won't work. but
the last two lines works. Any help is greatly appreciated.

Thanks
MVMurthy


--

Dave Peterson
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
Collection methods Christopher Benson-Manica Excel Programming 4 December 9th 04 06:22 PM
3 possible methods for adding value to a combobox Todd Huttenstine[_3_] Excel Programming 3 January 25th 04 01:16 AM
Populating ComboBox Methods Todd Huttenstine[_2_] Excel Programming 8 January 19th 04 12:14 AM
Populating Combobox Methods Todd Huttenstine[_2_] Excel Programming 10 January 18th 04 10:19 PM
Handout of Excel Object's Properties and Methods Luis Carrion Excel Programming 2 July 11th 03 01:51 PM


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