netwerkz
07-15-2016, 03:51 PM
Hi All,
I have a UserForm that is ran on a sheet called "fieldDataCalc" where a user will enter data into specific fields and upon pressing the "Accept Data" CommandButton, the data will be dumped into "fieldDataCalc". After that, I want the data to be copied and pasted on the next available line on another sheet called "fieldData".
So far, the only VBA Code I have is for the "Accept Data" action...
Private Sub cmdAccept_Click()
Dim RowCount As Long
Dim ctl As Control
RowCount = Worksheets("fieldDataCalc").Range("A2").CurrentRegion.Rows.Count
With Worksheets("fieldDataCalc").Range("A2")
.Offset(RowCount, 0).Value = Me.txtBox_fieldDataCalc_dateDelivered.Value
.Offset(RowCount, 1).Value = Me.comboBox_fieldDataCalc_fieldName.Value
.Offset(RowCount, 2).Value = Me.txtBox_fieldDataCalc_acres.Value
.Offset(RowCount, 3).Value = Me.comboBox_fieldDataCalc_crop.Value
End With
RowCount = Worksheets("fieldDataCalc").Range("E2").CurrentRegion.Rows.Count
With Worksheets("fieldDataCalc").Range("E2")
.Offset(RowCount, 0).Value = Me.txtBox_fieldDataCalc_product1_gallonsLoaded.Value
.Offset(RowCount, 1).Value = Me.txtBox_fieldDataCalc_product2_gallonsLoaded.Value
.Offset(RowCount, 2).Value = Me.txtBox_fieldDataCalc_product3_gallonsLoaded.Value
.Offset(RowCount, 3).Value = Me.txtBox_fieldDataCalc_product4_gallonsLoaded.Value
.Offset(RowCount, 4).Value = Me.txtBox_fieldDataCalc_product5_gallonsLoaded.Value
.Offset(RowCount, 5).Value = Me.txtBox_fieldDataCalc_product6_gallonsLoaded.Value
End With
End Sub
...and...
Option Explicit
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
, which is on the fieldDataCalc sheet.
16626
16627
I appreciate any assistance offered!
I have a UserForm that is ran on a sheet called "fieldDataCalc" where a user will enter data into specific fields and upon pressing the "Accept Data" CommandButton, the data will be dumped into "fieldDataCalc". After that, I want the data to be copied and pasted on the next available line on another sheet called "fieldData".
So far, the only VBA Code I have is for the "Accept Data" action...
Private Sub cmdAccept_Click()
Dim RowCount As Long
Dim ctl As Control
RowCount = Worksheets("fieldDataCalc").Range("A2").CurrentRegion.Rows.Count
With Worksheets("fieldDataCalc").Range("A2")
.Offset(RowCount, 0).Value = Me.txtBox_fieldDataCalc_dateDelivered.Value
.Offset(RowCount, 1).Value = Me.comboBox_fieldDataCalc_fieldName.Value
.Offset(RowCount, 2).Value = Me.txtBox_fieldDataCalc_acres.Value
.Offset(RowCount, 3).Value = Me.comboBox_fieldDataCalc_crop.Value
End With
RowCount = Worksheets("fieldDataCalc").Range("E2").CurrentRegion.Rows.Count
With Worksheets("fieldDataCalc").Range("E2")
.Offset(RowCount, 0).Value = Me.txtBox_fieldDataCalc_product1_gallonsLoaded.Value
.Offset(RowCount, 1).Value = Me.txtBox_fieldDataCalc_product2_gallonsLoaded.Value
.Offset(RowCount, 2).Value = Me.txtBox_fieldDataCalc_product3_gallonsLoaded.Value
.Offset(RowCount, 3).Value = Me.txtBox_fieldDataCalc_product4_gallonsLoaded.Value
.Offset(RowCount, 4).Value = Me.txtBox_fieldDataCalc_product5_gallonsLoaded.Value
.Offset(RowCount, 5).Value = Me.txtBox_fieldDataCalc_product6_gallonsLoaded.Value
End With
End Sub
...and...
Option Explicit
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
, which is on the fieldDataCalc sheet.
16626
16627
I appreciate any assistance offered!