Recalling data to userform based on TextBox value

StartingOut

Board Regular
Joined
Feb 1, 2011
Messages
92
Hi I have UserForm1 that writes 30+ items (TextBoxes, CheckBoxes, OptionButtons, and 2 ComboBoxes) to a batabase sheet. Each time the form opens UserForm1 generates a sequential Invoice number based on the last time data was writen to the Database. This sequential number is places in column "A" on the row with the data. I want to be able to open another Form "UserForm2" with the exact same group of TextBoxes and checkBoxes. In the TextBox on UserForm2 that from UserForm1 held the automaticaly generated sequential number I want to input any of the previous generated numbers which will then search for the row and then bring that row data back into the userform. after it is edited click an update buton which writes the data back to the Database sheet in the same row that the original data was held or delete the old row and write a new row so there is not duplicate entry

Her is sample of my code that send the data to the database sheet, I hope this questing is not to long. If it helps the TextBox that holds the sequential number is TextBox53.Value


With Worksheets("DataBase")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
.Cells(NextRow, 1).Value = TextBox53.Value
.Cells(NextRow, 2).Value = ComboBox1.Value
.Cells(NextRow, 3).Value = TextBox19.Value
.Cells(NextRow, 4).Value = CheckBox1.Caption
.Cells(NextRow, 5).Value = TextBox1.Value
.Cells(NextRow, 6).Value = TextBox2.Value
.Cells(NextRow, 7).Value = TextBox3.Value
.Cells(NextRow, 8).Value = TextBox10.Value
.Cells(NextRow, 9).Value = TextBox11.Value
.Cells(NextRow, 10).Value = TextBox40.Value
.Cells(NextRow, 11).Value = TextBox41.Value
.Cells(NextRow, 12).Value = TextBox42.Value
.Cells(NextRow, 13).Value = TextBox43.Value
.Cells(NextRow, 14).Value = TextBox44.Value
.Cells(NextRow, 15).Value = TextBox4.Value
.Cells(NextRow, 16).Value = TextBox5.Value
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
It may be easier rather than getting the box to place the information twice to copy the data from the sheet at the end of the macro to another place and then get values from there each time.
 
Upvote 0
thats what I have now, but is not good as I end up with a shhet for every row of data from the database sheet, which is over 300 rows.
 
Upvote 0
if you create a final row variable could you not use finalrow offset -16
to collect those values for your copy?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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