Block Error without End If

cdurfey

New Member
Joined
Sep 25, 2017
Messages
3
I keep getting this error when running the following code. Please help. Thanks

Rich (BB code):
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)

 If Not Intersect(Target, Range("B1")) Is Nothing Then


Dim myMSG As String


myString = "***Processing Customer Reports***"
mystring2 = "***Complete***"
Application.StatusBar = myString


'Turnoff Monitor updates


Application.ScreenUpdating = False


Application.DisplayAlerts = False


' Run # of Days of reports selected by User
 
If Target.Value = "1" Then
    Sheets("General Information").Select
    Application.Run "PERSONAL.XLSB!Customer_1_Day"
End If
 
If Target.Value = "2" Then
    Sheets("General Information").Select
    Application.Run "PERSONAL.XLSB!Combine2"
End If
 
If Target.Value = "3" Then
    Sheets("General Information").Select
    Application.Run "PERSONAL.XLSB!Combine3"
End If
 
If Target.Value = "4" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine4"
End If
 
If Target.Value = "5" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine5"
 End If
 
If Target.Value = "6" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine6"
End If


If Target.Value = "7" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine7"
End If
 
If Target.Value = "8" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine8"
End If
 
If Target.Value = "9" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine9"
End If


If Target.Value = "10" Then
     Sheets("General Information").Select
     Application.Run "PERSONAL.XLSB!Combine10"
End If
    
Application.ScreenUpdating = True


Application.StatusBar = False
    
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You need to add another End If just before the End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0
For reference, if you were willing to rename
Customer_1_Day macro to
Combine1
You could rewrite you event as follows
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("B1")) Is Nothing Then
    
        Dim myMSG As String
        
        myString = "***Processing Customer Reports***"
        mystring2 = "***Complete***"
        Application.StatusBar = myString
        
        
        'Turnoff Monitor updates
        Application.ScreenUpdating = False
        Application.DisplayAlerts = False
        
        Sheets("General Information").Select
        Application.Run "PERSONAL.XLSB!combine" & Target.Value
        
        Application.ScreenUpdating = True
        Application.StatusBar = False
    End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,961
Messages
6,175,651
Members
452,664
Latest member
alpserbetli

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