sonny1986
New Member
- Joined
- Apr 30, 2020
- Messages
- 5
- Office Version
- 2019
- Platform
- Windows
Hello!
i want to develop a dynamically changing tool storage database, in which we edit our tools inventory (new entries, scrapping old tools -delete from the list, but these tools are stored on fixed locations, these locations will be avaible for new entries). I'd like to create an userform with dropbox, including a list of avaible free locations on a shelf (these are random locations). The first criteria is, where wants my collegues to store a new tool (up-middle-down on a shelf) and excel to show the avaible free locations and the operator to select from here where te tool to be stored (1 tool can be stored on 1 or max 6 locations (consecutive)). Now, it's working if i fill the first textbox ( UserForm2.ts1.Value), but if i want to save on more than 1 but less then 6 position, my code is stop working (i think, because is no value in the next cells&textboxes...). How i can bypass this, or skip form the beginning the code to be broke? Thanks for answers!
i use the following code for saving from textboxes the data into database:
i want to develop a dynamically changing tool storage database, in which we edit our tools inventory (new entries, scrapping old tools -delete from the list, but these tools are stored on fixed locations, these locations will be avaible for new entries). I'd like to create an userform with dropbox, including a list of avaible free locations on a shelf (these are random locations). The first criteria is, where wants my collegues to store a new tool (up-middle-down on a shelf) and excel to show the avaible free locations and the operator to select from here where te tool to be stored (1 tool can be stored on 1 or max 6 locations (consecutive)). Now, it's working if i fill the first textbox ( UserForm2.ts1.Value), but if i want to save on more than 1 but less then 6 position, my code is stop working (i think, because is no value in the next cells&textboxes...). How i can bypass this, or skip form the beginning the code to be broke? Thanks for answers!
i use the following code for saving from textboxes the data into database:
VBA Code:
Private Sub savebt_Click()
If UserForm2.ts1.Value = "" Then
MsgBox "Select location!", vbExclamation, "SL No"
Exit Sub
End If
q1 = UserForm2.ts1.Value
Sheets("CLISEE").Select
Dim rowselect As Double
Dim msg As String
Dim ans As String
rowselect = UserForm2.ts1.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
If UserForm2.ts2.Value = True Then
Do
q2 = UserForm2.ts2.Value
Sheets("CLISEE").Select
rowselect = UserForm2.ts2.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
q3 = UserForm2.ts3.Value
Sheets("CLISEE").Select
rowselect = UserForm2.ts3.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
q4 = UserForm2.ts4.Value
Sheets("CLISEE").Select
rowselect = UserForm2.ts4.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
q5 = UserForm2.ts5.Value
Sheets("CLISEE").Select
rowselect = UserForm2.ts5.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
q6 = UserForm2.ts6.Value
Sheets("CLISEE").Select
rowselect = UserForm2.ts6.Value
rowselect = rowselect
Rows(rowselect).Select
Cells(rowselect - 998, 3) = UserForm2.TextBox12.Value
Cells(rowselect - 998, 4) = UserForm2.TextBox13.Value
Cells(rowselect - 998, 7) = UserForm2.ComboBox1.Value
Cells(rowselect - 998, 8) = UserForm2.ComboBox11.Value
Cells(rowselect - 998, 9) = UserForm2.TextBox25.Value
Loop
End If
Sheets("CLISEE").Select
ThisWorkbook.Sheets("clisee").Range("t2:z2").ClearContents
End Sub
Last edited by a moderator: