Hi everyone.
I have a user-form with a Combo-Box and 6 text fields and 3 buttons( Update, Reset, Exit). My Combo-Box contains all the worksheets( i have 4 of it) as it contents
How do I ensure that after updating my desired worksheets, the updates always falls in the new rows.
My subsequent updates always overrides the previous update and it defeating the idea of updating from the user-form
This is my update button code
Code
- Private Sub Cmd_Update_Data_Click()
- TargetSheet = Cmb_Application.Value ' Cmb_Application is the name of my Combo-Box
- If TargetSheet = "" Then
- MsgBox ("Please, Select the Region for the data update")
- Exit Sub
- End If
- Worksheets(TargetSheet).Activate
- Dim LastRow As Long
- LastRow = ActiveSheet.Range("D999999").End(xlUp).Row + 1
- ActiveSheet.Range("E" & LastRow).Value = Txt_Site_ID.Value 'Change accordingly
- ActiveSheet.Range("F" & LastRow).Value = Txt_Site_Address.Value
- ActiveSheet.Range("G" & LastRow).Value = Txt_CPD.Value
- ActiveSheet.Range("M" & LastRow).Value = Txt_DSD.Value
- ActiveSheet.Range("H" & LastRow).Value = Txt_SD.Value
- ActiveSheet.Range("I" & LastRow).Value = Txt_ED.Value
- MsgBox ("The data has been updated to " & TargetSheet & " sheet")
- End Sub
Please help