I have my project working great except for one detail that I missed, I am shaking my head in disbelief that I did so. And now I don't know how to proceed. So long story short I have an Userform that totals 4 textboxs and and puts the total in the Total textbox. Then lastly I have a textbox that appears that is the total plus tax when checkBox = True. The problem I have is when I save to Sheet1. It saves the total in column F. Well I failed to figure out how to Save the total With Tax instead when it is clicked with tax.. In a perfect world I would like the Total to disappear when the total with Tax appears and it saves the total with Tax. But I may not get so lucky haha.... Anyways I hope someone can help!
So code that saves to sheet
Then I have the Check Box Click event
Also I am guessing there is a better way of doing the coding I did but please don't make fun of me hahaha
So code that saves to sheet
Code:
Private Sub CommandButton5_Click() Dim rw As Long 'next available row
With Sheets("Sheet1")
'get the next available row in Sheet1
rw = .Range("B" & .Rows.Count).End(xlUp).Row + 1
'put the text box values in this row
'put the text box values in this row
.Range("B" & rw).Value = TextBox1.Value
.Range("C" & rw).Value = TextBox2.Value + " " + TextBox4.Value + " " + TextBox5.Value
.Range("E" & rw).Value = TextBox11.Value
.Range("H" & rw).Value = TextBox7.Value + " " + TextBox8.Value
.Range("I" & rw).Value = TextBox9.Value
.Range("M" & rw).Value = TextBox10.Value
.Range("F" & rw).Value = TextBox6.Value
.Range("J" & rw).Value = TextBox12.Value
.Range("K" & rw).Value = TextBox13.Value
.Range("L" & rw).Value = TextBox14.Value
.Range("O" & rw).Value = TextBox15.Value
.Range("D" & rw).Value = TextBox16.Value
.Range("G" & rw).Value = TextBox17.Value
End With
TextBox1.Value = Clear
TextBox2.Value = Clear
TextBox4.Value = Clear
TextBox5.Value = Clear
TextBox6.Value = Clear
TextBox7.Value = Clear
TextBox8.Value = Clear
TextBox9.Value = Clear
TextBox10.Value = Clear
TextBox11.Value = Clear
TextBox12.Value = Clear
TextBox13.Value = Clear
TextBox14.Value = Clear
TextBox15.Value = Clear
TextBox16.Value = Clear
TextBox17.Value = Clear
TextBox18.Value = Clear
TextBox19.Value = Clear
End Sub
Then I have the Check Box Click event
Code:
Private Sub CheckBox1_Click()
For Each Objctrl In Me.Controls
If Left(Objctrl.Name, 4) = "Text" Then Objctrl.Visible = CheckBox1.Value
Next
If CheckBox1 = True Then
TextBox6.Value = Cost.Value * 1.088
TextBox6.Value = Format(TextBox6.Value, "$#,##0.00")
Else
CheckBox1 = False
TextBox6.Value = ""
End If
End Sub
Also I am guessing there is a better way of doing the coding I did but please don't make fun of me hahaha
Last edited: