How to reset excel worksheet form lilstbox and combo box

R

ramseyprescott

I can reset all cells with a macro, but the form tools, such as my listbox and my combobox stay in a previous state. Help would be much appreciated.
 
R

ramseyprescott

I can reset all cells with a macro, but the form tools, such as my listbox and my combobox stay in a previous state. Help would be much appreciated.

Sub Submit1()

Application.ScreenUpdating = False

Sht0 = "Form"
Shtf = "Database"
Shtc = "Setup"
uf = Sheets(Shtf).Range("A65536").End(xlUp).Row + 1

For j1 = 23 To 32
If Sheets(Sht0).Cells(j1, 4) = "" Then Exit For
Sheets(Shtf).Cells(uf, 1) = Sheets(Sht0).Cells(5, 5)
Sheets(Shtf).Cells(uf, 2) = Sheets(Sht0).Cells(7, 5)
Sheets(Shtf).Cells(uf, 3) = Sheets(Sht0).Cells(9, 5)
Sheets(Shtf).Cells(uf, 4) = Sheets(Shtc).Cells(2, 2)
Sheets(Shtf).Cells(uf, 5) = Sheets(Shtc).Cells(2, 3)
Sheets(Shtf).Cells(uf, 6) = Sheets(Shtc).Cells(2, 1)
Sheets(Shtf).Cells(uf, 7) = Sheets(Shtc).Cells(2, 4)
Sheets(Shtf).Cells(uf, 8) = Sheets(Sht0).Cells(15, 12)
Sheets(Shtf).Cells(uf, 9) = Sheets(Sht0).Cells(15, 16)
Sheets(Shtf).Cells(uf, 10) = Sheets(Sht0).Cells(15, 15)
Sheets(Shtf).Cells(uf, 11) = Sheets(Sht0).Cells(17, 11)
Sheets(Shtf).Cells(uf, 12) = Sheets(Sht0).Cells(j1, 4)
Sheets(Shtf).Cells(uf, 13) = Sheets(Sht0).Cells(j1, 5)
Sheets(Shtf).Cells(uf, 14) = Sheets(Sht0).Cells(j1, 6)
Sheets(Shtf).Cells(uf, 15) = Sheets(Sht0).Cells(j1, 7)
Sheets(Shtf).Cells(uf, 16) = Sheets(Sht0).Cells(j1, 11)
Sheets(Shtf).Cells(uf, 17) = Sheets(Sht0).Cells(j1, 12)
Sheets(Shtf).Cells(uf, 18) = Sheets(Sht0).Cells(j1, 13)
Sheets(Shtf).Cells(uf, 19) = Sheets(Sht0).Cells(j1, 14)
Sheets(Shtf).Cells(uf, 20) = Sheets(Sht0).Cells(j1, 15)
uf = uf + 1
ux = ux + 1
Next j1

Sheets(Sht0).Range("Clear").ClearContents

Application.ScreenUpdating = True

End Sub
 
R

ramseyprescott

I can reset all cells with a macro, but the form tools, such as my listbox and my combobox stay in a previous state. Help would be much appreciated.

Sub Submit1()

Application.ScreenUpdating = False

Sht0 = "Form"
Shtf = "Database"
Shtc = "Setup"
uf = Sheets(Shtf).Range("A65536").End(xlUp).Row + 1

For j1 = 23 To 32
If Sheets(Sht0).Cells(j1, 4) = "" Then Exit For
Sheets(Shtf).Cells(uf, 1) = Sheets(Sht0).Cells(5, 5)
Sheets(Shtf).Cells(uf, 2) = Sheets(Sht0).Cells(7, 5)
Sheets(Shtf).Cells(uf, 3) = Sheets(Sht0).Cells(9, 5)
Sheets(Shtf).Cells(uf, 4) = Sheets(Shtc).Cells(2, 2)
Sheets(Shtf).Cells(uf, 5) = Sheets(Shtc).Cells(2, 3)
Sheets(Shtf).Cells(uf, 6) = Sheets(Shtc).Cells(2, 1)
Sheets(Shtf).Cells(uf, 7) = Sheets(Shtc).Cells(2, 4)
Sheets(Shtf).Cells(uf, 8) = Sheets(Sht0).Cells(15, 12)
Sheets(Shtf).Cells(uf, 9) = Sheets(Sht0).Cells(15, 16)
Sheets(Shtf).Cells(uf, 10) = Sheets(Sht0).Cells(15, 15)
Sheets(Shtf).Cells(uf, 11) = Sheets(Sht0).Cells(17, 11)
Sheets(Shtf).Cells(uf, 12) = Sheets(Sht0).Cells(j1, 4)
Sheets(Shtf).Cells(uf, 13) = Sheets(Sht0).Cells(j1, 5)
Sheets(Shtf).Cells(uf, 14) = Sheets(Sht0).Cells(j1, 6)
Sheets(Shtf).Cells(uf, 15) = Sheets(Sht0).Cells(j1, 7)
Sheets(Shtf).Cells(uf, 16) = Sheets(Sht0).Cells(j1, 11)
Sheets(Shtf).Cells(uf, 17) = Sheets(Sht0).Cells(j1, 12)
Sheets(Shtf).Cells(uf, 18) = Sheets(Sht0).Cells(j1, 13)
Sheets(Shtf).Cells(uf, 19) = Sheets(Sht0).Cells(j1, 14)
Sheets(Shtf).Cells(uf, 20) = Sheets(Sht0).Cells(j1, 15)
uf = uf + 1
ux = ux + 1
Next j1

Sheets(Sht0).Range("Clear").ClearContents

Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top