Combobox with Commandbutton in Userform!

S

Stift

Hi, Can someone please help me with creating an inputform in VBA with
excel database?

I want to have a userform that have a Combobox and a Commandbutton.

The combobox must contain all cells of Sheet1 Column C9-C63.
And only shows C9. When the user press the Command Button. It mus
show the next cell and so on till all cells are displayed.

This will help me creating a begin of my project for school so pleas
help me !!!


A lot of Thanks in advance !!!


Robber
 
B

BrianB

Set the combobox rowSource property to C9:C63.

Use this code in the form :-

'-----------------------------------------------------
Private Sub UserForm_Initialize()
Me.ComboBox1.ListIndex = 0
End Sub
'---------------------------------------

Private Sub CommandButton1_Click()
x = Me.ComboBox1.ListIndex
Me.ComboBox1.ListIndex = IIf(x = 54, 0, x + 1)
End Sub
'--------------------------------------
 
T

Tom Ogilvy

These should get you started:

http://support.microsoft.com/default.aspx?kbid=161514
XL97: How to Use a UserForm for Entering Data

http://support.microsoft.com/default.aspx?kbid=213749
XL2000: How to Use a UserForm for Entering Data

http://www.microsoft.com/ExcelDev/Articles/sxs11pt1.htm
Lesson 11: Creating a Custom Form
Excerpted from Microsoft® Excel 97 Visual Basic® Step by Step.
http://j-walk.com/ss/excel/tips/tip84.htm

http://support.microsoft.com/default.aspx?scid=kb;en-us;829070
How to use Visual Basic for Applications examples to control UserForms in
Microsoft Excel

http://support.microsoft.com/support/kb/articles/q213/7/32.asp
XL2000: Using the LoadPicture Function with an Image Control



Here are some other sources of information:


http://support.microsoft.com/?id=168067
File Title: Microsoft(R) Visual Basic(R) for Applications Examples for
Controlling UserForms in Microsoft Excel 97
File Name: WE1163.EXE
File Size: 161742 bytes
File Date: 05/08/97
Keywords: kbfile
Description: This Application Note is an introduction to manipulating
UserForms in Microsoft Excel 97. It includes examples and Microsoft Visual
Basic for Applications macros that show you how to take advantage of the
capabilities of UserForms and use each of the ActiveX controls that are
available for UserForms

Peter Aiken Articles:
Part I
http://msdn.microsoft.com/library/en-us/dnoffpro01/html/IntroductiontoUserFormsPartI.asp
Part II
http://msdn.microsoft.com/library/en-us/dnoffsol02/html/IntroductiontoUserFormsPartII.asp


http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q168067


Regards,
Tom Ogilvy
 
S

Stift

I get error : Runtime error 380

Could not set the List Index Property. Invalid property value
 
T

Tom Ogilvy

My guess would be that you are setting it to a value that does not exist.

The index property starts a zero and goes to the Listcount -1

You can also set it to -1 if you don't want anything selected.

Generally, if you want any meaningful help, you need to post the relevant
sections of your code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top