Compile error: Expected End Sub

dvart

New Member
Joined
Aug 19, 2016
Messages
11
Code:
Private Sub UpdateData()

'Initialise variables
    strDataAddress = wbNB.Worksheets("Calculations").Range("rDataAddress").Value
    
'Open data file
    Workbooks.Open (strDataAddress)
    Set wbData = ActiveWorkbook
    Set wsData = wbData.ActiveSheet

'Delete unrequired rows
    wsData.Rows("1:5").Delete
    
End Sub


Hi

My above code keeps coming up with the error 'Expected End Sub' but i've no idea why. The routine is called from a public routine that is assigned to a button. Can anybody help as it's driving me mental.

Thank you
 
It highlights 'frmProcessing' right at the very end.

Code:
    Set wbNB = Nothing
    Set wsNB = Nothing
    Set wbData = Nothing
    Set wsData = Nothing
    
    Application.ScreenUpdating = True
    
    Unload frmProcessing
    End Sub
 
Upvote 0
The form doesn't have any code either. I bet if i rewrote it again into a new module I wouldn't have this problem.
 
Upvote 0
Sorry had to go out. I have seen phantom things going on before in VBA so maybe. Never seen this before though.
 
Upvote 0

Forum statistics

Threads
1,226,865
Messages
6,193,419
Members
453,798
Latest member
jasonsd

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