Visual Basic Editor opens automatically when running macro

pecosvil

Board Regular
Joined
Apr 13, 2010
Messages
52
I have a very simple macro that sorts a table. For no apparent reason, when I run the macro it automatically opens the Visual Basic Editor window.

Any help?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It normally opens due to an error or a false stop,

Is there a line coloured yellow when it opens?
 
Upvote 0
can you post the code?

Code:
Sub Macro1()
'
' Macro1 Macro
'

'
    Application.Goto Reference:="Macro1"
    Range("B70:H91").Select
    ActiveWorkbook.Worksheets("Trades").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Trades").Sort.SortFields.Add Key:=Range("E71:E91") _
        , SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Trades").Sort
        .SetRange Range("B70:H91")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,632
Latest member
jladair

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