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

Fabrício Amaral 0 Reputation points
2024-01-29T15:28:21.74+00:00

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
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,511 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,645 questions
0 comments No comments
{count} votes