DinnerB0ne
New Member
- Joined
- Feb 17, 2020
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
New poster here, apologies if any annoyance caused.
I am trying to have my User form input it's data into a new row in a set range - but when I seem to do it it just will overwrite a pre-existing row WITH data inside of it.
Within one sheet I have two Catergories (not tables); One Called Insurance Claims and one Called Warranty Claims. What I want to do is create a button that will bring up a form that you fill out and will
automatically input the data into the correct table.
I have managed to get 50% of the way there and I have created the form and the data does indeed paste in the sheet. But it will overwrite a row with data already inside of it, where I want it to go to the bottom of the Insurance
Claim Rows -> insert the data -> add new row for next set of data. The Insurance Claim rows start from A3:A35 at the moment. I have attached photos to try and better understand this.
I'll input my code here for the form also
Please help me beat this !! Many thanks!
I am trying to have my User form input it's data into a new row in a set range - but when I seem to do it it just will overwrite a pre-existing row WITH data inside of it.
Within one sheet I have two Catergories (not tables); One Called Insurance Claims and one Called Warranty Claims. What I want to do is create a button that will bring up a form that you fill out and will
automatically input the data into the correct table.
I have managed to get 50% of the way there and I have created the form and the data does indeed paste in the sheet. But it will overwrite a row with data already inside of it, where I want it to go to the bottom of the Insurance
Claim Rows -> insert the data -> add new row for next set of data. The Insurance Claim rows start from A3:A35 at the moment. I have attached photos to try and better understand this.
I'll input my code here for the form also
VBA Code:
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub OKButton_Click()
Dim emptyRow As Long
'Make Insurance & Warranty Claims sheet active
Sheet1.Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A3:A35")) + 1
'Transfer information
Cells(emptyRow, 1).Value = TodaysDateBox.Value
Cells(emptyRow, 2).Value = NameBox.Value
Cells(emptyRow, 4).Value = AssetTagBox.Value
Cells(emptyRow, 6).Value = SerialNumberBox.Value
Cells(emptyRow, 7).Value = DamageBox.Value
Cells(emptyRow, 9).Value = NoteBox.Value
Cells(emptyRow, 10).Value = LocationListBox.Value
Cells(emptyRow, 11).Value = StatusBox.Value
Cells(emptyRow, 12).Value = HandlerBox.Value
Unload InsForm1
End Sub
Private Sub UserForm_Initialize()
'Empty TodaysDateBox
TodaysDateBox.Value = ""
'Empty NameBox
NameBox.Value = ""
'Empty AssetTagBox
AssetTagBox.Value = ""
'Empty SerialNumberBox
SerialNumberBox.Value = ""
'Empty DamageBox
DamageBox.Value = ""
'Empty NoteBox
NoteBox.Value = ""
'Empty LocationListBox
LocationListBox.Clear
'Fill LocationListBox
With LocationListBox
.AddItem "Kings"
.AddItem "Castle"
End With
End Sub
Please help me beat this !! Many thanks!