Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Userform Advice/Help

Need some help/advice

I have a spreadsheet with 40 rows

Each row contains the following

Column A = Last Name
Column B = First Name
Column C = Dollar Amount
Column D = Date
Column E = Comments (50 String Length)

I have a User Form with the following

Combobox1 = Column A and Column B
Textbox1 = Column A
Textbox2 = Column B
Textbox3 = Column C
Textbox4 = Column D
Textbox5 = Column E

Controlbutton1 = Update
Controlbutton2 = Cancel

I want to be able to load the combobox1 with column a/b rows 1 to 40

When a user scrolls the combobox1 I want the corresponding textboxes from
the spreadsheet to be filled in. (if the user scrolls the second name row
2, then textbox1 = row 2 col a, textbox1 = row 2 col b, etc…

If a user changes the data in the userform I want to update the
spreadsheet for that record.

Does this make any sense.

I need to be shown how this can be done. I'm not even sure it can be
done.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Userform Advice/Help

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Userform Advice/Help

Thanks Paul, That was enough to get me started. The rowsource was what I
was looking for. Works just like I wanted it to. Now I can go play with
it.


"Paul Martin" wrote in
ups.com:

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Userform Advice/Help

Hey Paul, Everything went find until the update portion.
When I wnet and did the update the only cell(S) that updated
on the spreadsheet were column a

here is my code

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value


End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
UserForm1.Hide
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.RowSource = "a1:e40"
End Sub





"Paul Martin" wrote in
ups.com:

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Userform Advice/Help

Hi Pete

I'm not sure what your problem is. What's the error you're getting?

Just a couple of points on the side:
- You do not need to code the ComboBox properties. You can set these
properties in the Properties Window (View, Properties Window)
- If you're unloading UserForm1, you do not need to hide it.

Regards

Paul Martin
Melbourne, Australia



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform Advice/Help

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
Hey Paul, Everything went find until the update portion.
When I wnet and did the update the only cell(S) that updated
on the spreadsheet were column a

here is my code

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value


End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
UserForm1.Hide
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.RowSource = "a1:e40"
End Sub





"Paul Martin" wrote in
ups.com:

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Userform Advice/Help

Hi Tom

Why would one use ComboBox1.List over ComboBox1.RowSource?

Regards



"Tom Ogilvy" wrote:

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
Hey Paul, Everything went find until the update portion.
When I wnet and did the update the only cell(S) that updated
on the spreadsheet were column a

here is my code

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value


End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
UserForm1.Hide
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.RowSource = "a1:e40"
End Sub





"Paul Martin" wrote in
ups.com:

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Userform Advice/Help

Paul, the update does not work

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer

iRow = ComboBox1.ListIndex + 1
'note that only cell a gets updated
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
'cells b to e revert back to the orginal spreadsheet values
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value

End Sub

So if row 5 a:e contains the following

a5 b5 c5 d5 e5

and on the userform (which is working) I change textbox2 (refering to b5)
to anything else (same for textbox 3 to 5) it does not change the
spreadsheet values.

if i make a change to textbox1 and click the command button to update it
only updates column a

does that help?



"Paul Martin" wrote in
oups.com:

Hi Pete

I'm not sure what your problem is. What's the error you're getting?

Just a couple of points on the side:
- You do not need to code the ComboBox properties. You can set these
properties in the Properties Window (View, Properties Window)
- If you're unloading UserForm1, you do not need to hide it.

Regards

Paul Martin
Melbourne, Australia


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Userform Advice/Help

Alright Tom, that worked, Thanks. But why? I am confused as to why
rowsource did not work and List did..




"Tom Ogilvy" wrote in news:O3WGO#aWFHA.1040
@TK2MSFTNGP10.phx.gbl:

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Userform Advice/Help

Pete

I tested the code using ListIndex, and it works for me.

Regards

Paul Martin
Melbourne, Australia

"Pete" wrote:

Alright Tom, that worked, Thanks. But why? I am confused as to why
rowsource did not work and List did..




"Tom Ogilvy" wrote in news:O3WGO#aWFHA.1040
@TK2MSFTNGP10.phx.gbl:

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform Advice/Help

When you change the range referred to by rowsource, you cause another change
event to fire and I assume this clears your textboxes. Whatever happens,
there is a bad interaction invoked. In xl97, it causes a crash in my
experience (this is more towards having the rowsource alteration in the
change event itself - not the case here). In any event, disconnecting the
rowsource before making the change is usually successful. Here, I broke it
by assigning the values to the list. You can also do it by recording what
you need to work with, then clearing the rowsource and then resetting it
after making the changes, all in the same event. This type approach might
need a bit of tweaking since you have the two events.

--
Regards,
Tom Ogivly


"Pete" wrote in message
...
Alright Tom, that worked, Thanks. But why? I am confused as to why
rowsource did not work and List did..




"Tom Ogilvy" wrote in news:O3WGO#aWFHA.1040
@TK2MSFTNGP10.phx.gbl:

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub




  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform Advice/Help

To avoid the problem experienced by the OP.

--
Regards,
Tom Ogilvy

"Paul Martin" wrote in message
...
Hi Tom

Why would one use ComboBox1.List over ComboBox1.RowSource?

Regards



"Tom Ogilvy" wrote:

Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

--
Regards,
Tom Ogilvy

"Pete" wrote in message
...
Hey Paul, Everything went find until the update portion.
When I wnet and did the update the only cell(S) that updated
on the spreadsheet were column a

here is my code

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value


End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
UserForm1.Hide
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.RowSource = "a1:e40"
End Sub





"Paul Martin" wrote in
ups.com:

Hi Pete

You'll need to set your ComboBox ColumnCount property to 2, and
RowSource to A1:E40. This will populate the ComboBox.

On the ComboBox_Change() event, you'll need something like:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
txtbox1.Value = Cells(iRow, 1).Value
txtbox2.Value = Cells(iRow, 2).Value
txtbox3.Value = Cells(iRow, 3).Value
etc

If you have a CommandButton to save the textbox values to the
worksheet, on the Button_Click() event put:

Dim iRow as Integer

iRow = ComboBox.ListIndex + 1
Cells(iRow, 1).Value = txtbox1.Value
Cells(iRow, 2).Value = txtbox2.Value
etc

Regards

Paul Martin
Melbourne, Australia








  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Userform Advice/Help

OP?

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Userform Advice/Help

OK, that's very helpful thanks Tom

Regards

Paul Martin
Melbourne, Australia

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Userform Advice/Help

Original Poster.

Paul Martin wrote:

OP?


--

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
any advice pls.. DumbLittleMan Excel Discussion (Misc queries) 1 September 4th 07 09:10 PM
Almost got it !! but need advice Nospam Excel Worksheet Functions 6 February 28th 05 10:27 AM
Advice please Greg New Users to Excel 2 February 24th 05 12:19 PM
RTD Advice JD Excel Programming 2 October 22nd 04 11:29 AM
In need of advice? onedaywhen Excel Programming 6 June 7th 04 02:22 PM


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