Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA Forms

Status
Not open for further replies.

metalboy

Technical User
Apr 1, 2004
97
GB
Hi All,

I am trying to create a spreadsheet which many people need to input information in each day. To make sure people input the correct information i wanted to do as follows.

When opening the woorkbook it opens to the sheet which is for todays date. A form then opens which a person can select their name. Then a form opens so they can input the information they need to and only that then they click a command button which saves it and closes.

I am very basic but can create the forms but the drop down list and getting the information from a text box to a cell is a bit beyond me at present.

Regards to all and thankyou in advance!

Regards

Alex

“It is a mistake to think you can solve any major problems just with potatoes.”
Douglas Adams
 
A coupla thoughts

What is the purpose of selecting a user name? You don't seem to be doing anything with it once selected.

If you are using the name once selected why not just have the listbox and the text box on the same form?

Where are keeping the list of user names that you will use to populate a list box?

To populate the list box you could either have the list on a sheets and refer to it there.
eg
Code:
Me.ListBox1.List = Range("lbRange").Value
Or you could code the values (names) to be added.
Have a look at the AddItem method and the list properties of the listbox in help.

To add the textbox text to a sheet use something like this
Code:
Private Sub CommandButton1_Click()
Dim lRow As Long
With Worksheets("sheet2")
    lRow = .[a65536].End(xlUp).Row
    If lRow = 1 And .[a1] <> "" Then lRow = 2
        .Cells(lRow, 1) = Me.ListBox1.Value
        .Cells(lRow, 2) = Me.TextBox1.Text
End With
Unload Me
End Sub

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Thanks for that that is a great start. I needed to sect the user name because each person needs to enter different data. So once they have selected their name they will be presented with a specific form with only the data they need to input..

Regards

Alex

“It is a mistake to think you can solve any major problems just with potatoes.”
Douglas Adams
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top