I have a userform to populate 11 goals. When I update, all fields need to be entered. Otherwise, if I leave one of the goals blank the current value is replaced with a blank cell.
This is the code for my userform:
Private Sub cmdAdd_Click()
Dim ws As Worksheet
Set ws = Worksheets("Dashboard")
ActiveSheet.Unprotect
ws.Cells(76, 11).Value = TextBox1.Value
Debug.Print TextBox2.Value
ws.Cells(76, 15).Value = TextBox2.Value
Debug.Print TextBox2.Value
ws.Cells(76, 18).Value = TextBox3.Value
Debug.Print TextBox3.Value
ws.Cells(76, 21).Value = TextBox4.Value
ws.Cells(76, 24).Value = TextBox5.Value
ws.Cells(76, 25).Value = TextBox6.Value
ws.Cells(76, 28).Value = TextBox7.Value
ws.Cells(76, 31).Value = TextBox8.Value
ws.Cells(76, 34).Value = TextBox9.Value
ws.Cells(76, 41).Value = TextBox10.Value
ws.Cells(76, 45).Value = TextBox11.Value
Unload Me
ActiveSheet.Protect
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub UserForm1_Initialize()
Me.TextBox1.Value = ThisWorkbook.Sheets("Dashboard").Range("A1").Value
End Sub
I would like the ability to update a few of the values without replacing the existing values.
Bookmarks