sir i explain project my userform contain 2 macro. every time enter data data will be add in worksheet "DATA" in last blank rows every time.
Macro 1 is "FillDocCenterAmount"
Macro 2 is "FillDateSenderFrom"
i need Result show as below after 2 macro runs
DATE
| SENDER
| FROM | DOC NO | CENTER
| AMOUNT |
03/11/2018
| KALPESH
| BARODA | 132455456
| DELHI
| 50 |
03/11/2018
| KALPESH
| BARODA | 132455457
| BHARUCH
| 30 |
03/11/2018
| KALPESH
| BARODA | 132455458 | SURAT
| 30
|
03/11/2018 | KALPESH
| BARODA | 132455459 | SAVLI
| 30
|
03/11/2018 | KALPESH
| BARODA | 132455460 | NAVSARI
| 30 |
<colgroup><col style="mso-width-source:userset;mso-width-alt:3108;width:64pt" width="85"> <col style="mso-width-source:userset;mso-width-alt:4352;width:89pt" width="119"> <col style="mso-width-source:userset;mso-width-alt:3218;width:66pt" width="88"> <col style="mso-width-source:userset;mso-width-alt:3328;width:68pt" width="91"> <col style="mso-width-source:userset;mso-width-alt:3949;width:81pt" width="108"> <col style="mso-width-source:userset;mso-width-alt:3108;width:64pt" width="85"> </colgroup><tbody>
</tbody>
Sub FillDocCenterAmount()
Dim i As Integer
For i = 4 To 8
If Controls("TextBox" & i) <> "" Then
If Worksheets("DATA").Range("D1").Offset(1, 0).Value = "" Then
Worksheets("DATA").Range("D1").Offset(1, 0).Value = Controls("TextBox" & i).Text
Else
Worksheets("DATA").Range("D1").End(xlDown).Offset(1, 0).Value = Controls("TextBox" & i).Text
End If
End If
Next i
For i = 9 To 13
If Controls("TextBox" & i) <> "" Then
If Worksheets("DATA").Range("E1").Offset(1, 0).Value = "" Then
Worksheets("DATA").Range("E1").Offset(1, 0).Value = Controls("TextBox" & i).Text
Else
Worksheets("DATA").Range("E1").End(xlDown).Offset(1, 0).Value = Controls("TextBox" & i).Text
End If
End If
Next i
For i = 14 To 18
If Controls("TextBox" & i) <> "" Then
If Worksheets("DATA").Range("F1").Offset(1, 0).Value = "" Then
Worksheets("DATA").Range("F1").Offset(1, 0).Value = Controls("TextBox" & i).Text
Else
Worksheets("DATA").Range("F1").End(xlDown).Offset(1, 0).Value = Controls("TextBox" & i).Text
End If
End If
Next i
End Sub
Sub FillDateSenderFrom()
For i = 1 To 3
If Controls("TextBox" & i) <> "" Then
If i = 1 Then
Worksheets("DATA").Activate
Cells(Rows.Count, 2).End(xlUp).End(xlToLeft).Offset(0, i - 1).Select
Range(ActiveCell, ActiveCell.End(xlUp).Offset(1, 0)).Value = Controls("TextBox" & i).Text
Else
Cells(Rows.Count, 2).End(xlUp).End(xlToLeft).Offset(0, 1).Select
Range(ActiveCell, ActiveCell.End(xlUp).Offset(1, 0)).Value = Controls("TextBox" & i).Text
End If
End If
Next i
End Sub