Excel closing by itself after executing recorded macro. How to fix?

Copper Contributor

Excel closing by itself after executing recorded macro. How to fix? (translated via Google Translate, there may be errors)

Macro:

Sub ClassiftLancamentosGerais()
'
' ClassiftLancamentosGerais Macro
'

'
Range("tLancamentosGerais").Select
ActiveWorkbook.Worksheets("Lançamentos Gerais").ListObjects( _
"tLancamentosGerais").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Lançamentos Gerais").ListObjects( _
"tLancamentosGerais").Sort.SortFields.Add2 Key:=Range( _
"tLancamentosGerais[Vencimento]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Lançamentos Gerais").ListObjects( _
"tLancamentosGerais").Sort.SortFields.Add2 Key:=Range( _
"tLancamentosGerais[Item]"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Lançamentos Gerais").ListObjects( _
"tLancamentosGerais").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B16").Select
End Sub

0 Replies