ajay_gajree
Well-known Member
- Joined
- Jul 16, 2011
- Messages
- 518
Hi All
I have a userform (Code below) that writes new data to a new row in an Excel Table.
What I also want to build is the ability to search for a row in the database (Column A in the table is a primary key) and then allow a user to overwrite the data as per the userform.
Not too sure how to go about this so any advice or if anyone can suggest where to look on the internet for some assistance would be great!
I have a userform (Code below) that writes new data to a new row in an Excel Table.
What I also want to build is the ability to search for a row in the database (Column A in the table is a primary key) and then allow a user to overwrite the data as per the userform.
Not too sure how to go about this so any advice or if anyone can suggest where to look on the internet for some assistance would be great!
Code:
Private Sub cmdAdd_Click()
Dim oNewRow As ListRow
Dim rng As Range
Set rng = ThisWorkbook.Worksheets("BRP Database").Range("tblBRPDatabase")
ThisWorkbook.Worksheets("BRP Database").Select
rng.Select
Set oNewRow = Selection.ListObject.ListRows.Add(AlwaysInsert:=True)
With rng
oNewRow.Range.Cells(1, 2).Value = Format(Me.cboQtr.Value, "MMM-YY")
oNewRow.Range.Cells(1, 4).Value = Me.cboBusiness.Value
oNewRow.Range.Cells(1, 5).Value = Me.cboLvl2.Value
oNewRow.Range.Cells(1, 6).Value = Me.cboRAG.Value
oNewRow.Range.Cells(1, 7).Value = Me.cboForwardLook.Value
oNewRow.Range.Cells(1, 8).Value = Me.txtCommentary.Value
oNewRow.Range.Cells(1, 9).Value = Me.cboLvl1RiskAppetiteRAG.Value
oNewRow.Range.Cells(1, 9).Value = Me.cboLvl2RiskAppetiteRAG.Value
End With
'Clear input controls.
Me.cboQtr.Value = ""
ThisWorkbook.Worksheets("Non Financial BRP Dashboards").Select
End Sub