Hi.
Forget about the text or combobox for scrolling through your invoices. use a spin button.
Link that to a textbox that will show your selected invoice
the spin button value will be the row in your database.
all your data should be in textboxes so that they are simple to load and save.
The following is untested but should work.
READ Data from excel to vba.
LR = spinbutton1.value
myarray = range(cells(LR,1),cells(LR,70)).value
Fill Texboxes
For Count = 1 To 70
'Load Text Boxes
Me.Controls("Textbox" & Count).Text = MyArray(1, Count)
Next
Write Texboxes to array
For Count = 1 To 70
'Load Text Boxes
MyArray(1, Count) = Me.Controls("Textbox" & Count).Text
Next
Write Data from Array to Excel
range(cells(LR,1),cells(LR,70)).value = myarray
To tranfer Spinbutton value to text box.
You need to declare a variable at the top of your module
Dim ChangeFlag as integer
private sub spinbutton1_change()
if changeflag = 1 then exit sub
Changeflag = 1
textbox1.value = Spinbutton1.value
changeflag = 0
end sub
To allow direct input into textbox
private sub Textbox1_change()
if changeflag = 1 then exit sub
Changeflag = 1
Spinbutton1.value = textbox1.value
changeflag = 0
end sub
Bookmarks