HELP!!! Saving data to worksheet!

pcstover

New Member
Joined
Aug 2, 2007
Messages
12
I have a userform that has 1 combo box that retrieves info into 12 textboxes. I have 3 command buttons, Save info, Close, and Print Form. All works well except if you edit the info pulled into the textboxes, it saves the new info on a new row. What would be the correct code for the user to edit the info retrieved from the combobox and the info be saved to same row instead of a new row?

Here's a sample of my code to save the new info

Private Sub ComboBox1_Change()
TextBox1 = Sheets("Sheet1").Range("B" & ComboBox1.ListIndex + 2)
TextBox2 = Sheets("Sheet1").Range("C" & ComboBox1.ListIndex + 2)
TextBox3 = Sheets("Sheet1").Range("D" & ComboBox1.ListIndex + 2)
TextBox4 = Sheets("Sheet1").Range("E" & ComboBox1.ListIndex + 2)
TextBox5 = Sheets("Sheet1").Range("F" & ComboBox1.ListIndex + 2)
TextBox6 = Sheets("Sheet1").Range("G" & ComboBox1.ListIndex + 2)
TextBox7 = Sheets("Sheet1").Range("H" & ComboBox1.ListIndex + 2)
TextBox8 = Sheets("Sheet1").Range("I" & ComboBox1.ListIndex + 2)
TextBox9 = Sheets("Sheet1").Range("J" & ComboBox1.ListIndex + 2)
TextBox10 = Sheets("Sheet1").Range("K" & ComboBox1.ListIndex + 2)
TextBox11 = Sheets("Sheet1").Range("L" & ComboBox1.ListIndex + 2)
TextBox12 = Sheets("Sheet1").Range("M" & ComboBox1.ListIndex + 2)


End Sub

Here's what I use to save the info for NEW info.
ws.Cells(iRow, 1).Value = Me.ComboBox1.Value
ws.Cells(iRow, 2).Value = Me.TextBox1.Value
ws.Cells(iRow, 3).Value = Me.TextBox2.Value
ws.Cells(iRow, 4).Value = Me.TextBox3.Value
ws.Cells(iRow, 5).Value = Me.TextBox4.Value
ws.Cells(iRow, 6).Value = Me.TextBox5.Value
ws.Cells(iRow, 7).Value = Me.TextBox6.Value
ws.Cells(iRow, 8).Value = Me.TextBox7.Value
ws.Cells(iRow, 9).Value = Me.TextBox8.Value
ws.Cells(iRow, 10).Value = Me.TextBox9.Value
ws.Cells(iRow, 11).Value = Me.TextBox10.Value
ws.Cells(iRow, 12).Value = Me.TextBox11.Value
ws.Cells(iRow, 13).Value = Me.TextBox12.Value

Thanks so much for any guidance I can get! I'm at a loss for some reason.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top