Compile Error; HELP!!!

MWhiteDesigns

Well-known Member
Joined
Nov 17, 2010
Messages
646
Office Version
  1. 2016
Platform
  1. Windows
Hey Guys,
So I am attempting to create a userform to make it more user friendly to enter data. I am receiving a compile error stating: Block If without End If. Below is the code I am using.

How can I correct this!? Sorry I am still trying to learn this and I've tried to research as much as possible with no luck!
__________________________________________
Private Sub CmdEnterData_Click()
Dim RowCount As Long
RowCount = Worksheets("Process Tracker").Range("A1").CurrentRegion.Rows.Count

With Worksheets("Process Tracker").Range("A1")
.Offset(RowCount, 3).Value = Me.NameTextBox.Value
.Offset(RowCount, 1).Value = Me.RequestComboBox.Value

If Me.ARCheckBox.Value = True Then
.Offset(RowCount, 0).Value = "AR# "
If Me.ACCheckBox.Value = True Then
.Offset(RowCount, 0).Value = "Non AC# "
If Me.ClassCheckBox.Value = True Then
.Offset(RowCount, 0).Value = "Class# "

.Offset(RowCount, 4).Value = Me.DeptComboBox.Value
.Offset(RowCount, 5).Value = Me.SystemComboBox.Value
.Offset(RowCount, 6).Value = DateValue(Me.DateReceivedTextBox.Value)
.Offset(RowCount, 8).Value = DateValue(Me.DateSubmittedTextBox.Value)


.Offset(RowCount, 12).Value = Me.CommentsTextBox.Value


End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Code:
Private Sub CmdEnterData_Click()
Dim RowCount As Long
RowCount = Worksheets("Process Tracker").Range("A1").CurrentRegion.Rows.Count

With Worksheets("Process Tracker").Range("A1")
.Offset(RowCount, 3).Value = Me.NameTextBox.Value
.Offset(RowCount, 1).Value = Me.RequestComboBox.Value

If Me.ARCheckBox.Value = True Then .Offset(RowCount, 0).Value = "AR# "
If Me.ACCheckBox.Value = True Then .Offset(RowCount, 0).Value = "Non AC# "
If Me.ClassCheckBox.Value = True Then .Offset(RowCount, 0).Value = "Class# "

.Offset(RowCount, 4).Value = Me.DeptComboBox.Value
.Offset(RowCount, 5).Value = Me.SystemComboBox.Value
.Offset(RowCount, 6).Value = DateValue(Me.DateReceivedTextBox.Value)
.Offset(RowCount, 8).Value = DateValue(Me.DateSubmittedTextBox.Value)


.Offset(RowCount, 12).Value = Me.CommentsTextBox.Value

End With
End Sub
 
Upvote 0
Thank you guys. It's weird, earlier I had type End With before End Sub and I still received the error.

Now to the next question. Now that the error is no longer populating, When I click the enter data button. Nothing is transposed to the spreadsheet! :(
 
Upvote 0
Thank you guys. It's weird, earlier I had type End With before End Sub and I still received the error.

Now to the next question. Now that the error is no longer populating, When I click the enter data button. Nothing is transposed to the spreadsheet! :(

It wasn't just the missing End With - you also had 3 If Statements without an End If, which I converted into single-line If Statements that don't need an End If.

Re the code not doing what you expected, try stepping through the code usig F8.
 
Upvote 0
Is there a site that anyone knows about that would give a more detailed description on userform information? All the sites i have found show code but don't describe it very well. I am brand new to this so please bare with me :)
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,710
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