userform

cmccabe

Active Member
Joined
Feb 20, 2008
Messages
396
I am trying to use a userform to enter data and can not seem to have the next data entry appear on a new line. It is a simple userform that has about 10 fields that are inputted and then the user clicks a button that transfers the data and allows for another entry. However, i do not seem to be doing that correctly. Thanks.
Code:
Private Sub cmdTransfer_Click()
Dim RowCount As Long
'Range("A2") = txtCase.Value
'Range("B2") = txtEnd.Value
'Range("C2") = txtReview.Value
'Range("D2") = cboDx.Text
'Range("E2") = txtAge.Value
'Range("F2") = cboAge.Text
'Range("G2") = cboGender.Text
'Range("H2") = cboStatus.Text
'Range("I2") = cbLSAB.Text
'Range("J2") = cbSSPHR.Text
'Range("K2") = cbSSPLR.Text
'Range("L2") = cbSBT.Text
'Range("M2") = cboDonor.Text
'Range("N2") = txtType.Text
'Range("O2") = txtKey.Text
RowCount = Worksheets("HSCBM_RD").Range("A2").CurrentRegion.Rows.Count
With Worksheets("HSCBM_RD").Range("A2")
    .Offset(RowCount, 0) = Me.txtCase.Value
    .Offset(RowCount, 1) = Me.txtEnd.Value
    .Offset(RowCount, 2) = Me.txtReview.Value
    .Offset(RowCount, 3) = Me.cboDx.Value
    .Offset(RowCount, 4) = Me.txtAge.Value
    .Offset(RowCount, 5) = Me.cboAge.Value
    .Offset(RowCount, 6) = Me.cboGender.Value
    .Offset(RowCount, 7) = Me.cboStatus.Value
    .Offset(RowCount, 8) = Me.cbLSAB.Value
    .Offset(RowCount, 9) = Me.cbSSPHR.Value
    .Offset(RowCount, 10) = Me.cbSSPLR.Value
    .Offset(RowCount, 11) = Me.cbSBT.Value
    .Offset(RowCount, 12) = Me.cboDonor.Value
    .Offset(RowCount, 13) = Me.txtType.Value
    .Offset(RowCount, 14) = Me.txtKey.Value
End With
End Sub
 
There are no other workbooks open and there is no other code is above that. When I hoover over both:

Code:
 NextRow = WorksheetsHSCBM_RD").Range("A" & Rows.Count).End(xlUp).Row + 1
 
    Set rng = Worksheets("HSCBM_RD").Range("A" & NextRow)
Nothing appears and those two lines of code do not get highlighted.
 
rng.Offset(0, 0).Value = Me.txtCase.Text
    rng.Offset(0, 1).Value = Me.txtEnd.Text
    rng.Offset(0, 2).Value = Me.txtReview.Text
    rng.Offset(0, 3).Value = Me.cboDx.Text
    rng.Offset(0, 4).Value = Me.txtAge.Text
    rng.Offset(0, 5).Value = Me.cboAge.Text
    rng.Offset(0, 6).Value = Me.cboGender.Text
    rng.Offset(0, 7).Value = Me.cboStatus.Text
    rng.Offset(0, 8).Value = Me.cbLSAB.Value
    rng.Offset(0, 9).Value = Me.cbSSPHR.Value
    rng.Offset(0, 10).Value = Me.cbSSPLR.Value
    rng.Offset(0, 11).Value = Me.cbSBT.Value
    rng.Offset(0, 12).Value = Me.cboDonor.Text
    rng.Offset(0, 13).Value = Me.txtType.Text
    rng.Offset(0, 14).Value = Me.txtKey.Text
These are highlighted and the values entered in the text boxes appear when I hoover over.
Thanks.
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
In the code?

NextRow = Worksheets("HSCBM_RD").Range("A" & Rows.Count).End(xlUp).Row + 1


When I step through and hoover over NextRowit no value appears. I'm not sure if that is the information you desire. The data entry doesn't tranfer from the userform to the spreadsheet either. Thanks.
 
Upvote 0
I found the data but it is in row 204. It should appear in row 3 as that is the first blank row. Thanks.
 
Upvote 0
That means the data is being transferred to the worksheet but not where you expect it to be.

Is there anything, including formatting, in column A?
 
Upvote 0
Column A is formatted to a number... it is entered in a textbox but since it is a tracking identifier a number is used. Thanks.
 
Upvote 0
Can you upload the file somewhere?

I can't see why the code doesn't work.

The reason I asked about the formatting is because sometimes if you try and find the last row in a column with formatting it doesn't work.

If you can upload the file I can take a look at it.
 
Upvote 0
There were formatted cells in 199-203, that is where the groups for the pull-downs start. So it was putting the data in 204 (after the formatting). Is there a way that the previous data entry on the userform can be cleared so that multiple entries can be made? So, iwhen the entry for 1 is transfered it is also cleared so a new entry can be made? Thanks for all you help and sorry for the confusion and if I was a bother.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top