Hi guys,
I want copy data from all of textboxes on userform to sheet
column A should populate date , column B=textbox1,column C =textbox2, column D=textbox3
column E should calculate as I put the formulas( formula in second row is not after until before TOTAL row ).
TOTAL row should sum columns C,D
textbox2,3 will add numeric values
should copy and fill in blank rows , if there is no blank rows then will add new blank row before total row with the same formatting .
I don't need showing any formula.
here is my data on sheet & code
also posted here
fill blank rows or insert blank rows before lastrow by userform
thanks
I want copy data from all of textboxes on userform to sheet
column A should populate date , column B=textbox1,column C =textbox2, column D=textbox3
column E should calculate as I put the formulas( formula in second row is not after until before TOTAL row ).
TOTAL row should sum columns C,D
textbox2,3 will add numeric values
should copy and fill in blank rows , if there is no blank rows then will add new blank row before total row with the same formatting .
I don't need showing any formula.
here is my data on sheet & code
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2,E5 | E2 | =C2-D2 |
E3:E4 | E3 | =E2+C3-D3 |
C5:D5 | C5 | =SUM(C2:C4) |
VBA Code:
Private Sub CommandButton1_Click()
Dim LR As Long
Dim ws As Worksheet
Set ws = Sheets("ATSS")
With ws
LR = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A" & LR + 1) = Date
.Range("B" & LR + 1) = TextBox1.Text
.Range("C" & LR + 1) = TextBox2.Text
.Range("D" & LR + 1) = TextBox3.Text
End With
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
End Sub
fill blank rows or insert blank rows before lastrow by userform
thanks