Excel_User_10k
Board Regular
- Joined
- Jun 25, 2022
- Messages
- 100
- Office Version
- 2021
- Platform
- Windows
VBA Code:
Private Sub cmd_Submit_Click()
Dim myRow As ListRow
Dim intRows As Integer
intRows = ActiveWorkbook.Worksheets("Sales MTD").ListObjects("Submitted_Sales").ListRows.Count
Set myRow = ActiveWorkbook.Worksheets("Sales MTD").ListObjects("Submitted_Sales").ListRows.Add(intRows)
myRow.Range(1) = Range("C10")
myRow.Range(2) = Range("C3")
myRow.Range(3) = Range("C4")
myRow.Range(4) = Range("D4")
myRow.Range(5) = Range("E4")
myRow.Range(6) = Range("C5")
myRow.Range(7) = Range("F4")
myRow.Range(8) = Range("F5")
myRow.Range(9) = Range("H9")
myRow.Range(10) = Range("C6")
myRow.Range(11) = Range("F6")
myRow.Range(12) = Range("D3")
myRow.Range(13) = Range("C7")
myRow.Range(14) = Range("F7")
myRow.Range(15) = Range("E3")
myRow.Range(15) = Range("C8")
myRow.Range(16) = Range("F8")
myRow.Range(17) = Range("F3")
myRow.Range(18) = Range("C9")
myRow.Range(19) = Range("F9")
myRow.Range(20) = Range("F10")
End Sub
I have currently got an "Order Form" on one Sheet to Submit an entry for a Sale that has a variety of Extras, Insurances, Type of Sale, etc. I have an ActiveX button that I am using with the above code so that once all of the selections are made with the help of VLOOKUP from the catalogue on a 2nd Sheet, it adds a row to a Table on the 3rd Sheet Where it automatically fills in each column with the relevant criteria in relation to the selections made in the Order Form.
Firstly, the Formula is currently working. However, I have come across two issues...
1) For some reason it is not adding a row to the bottom of the Table, but to the 2nd to bottom. (I would also be filtering through the data at times so whether that has any effect on this too I am not sure - If for instance, a row was added when all filters haven't been cleared or they aren't in the original order, will it still add a row to the bottom of the table?)
2) On the new Row that is added, the side border is cleared/missing on some of the cells randomly. This doesn't affect the functionality but it is annoying haha.
Any ideas on why it is doing this? I saw someone else use the same code (but not with as many Columns) and it added it at the bottom/end for them.