Как вывести в строке состояния (statusbar) процент обработанных ячеек — Basic(Бейсик)

Private Sub MyStatusBar()
    Dim iTarget As Range, iCell As Range
    Set iTarget = ThisWorkbook.Worksheets(1).UsedRange '.Range("A1:A50")

    With Application
         iProcent# = 100 / iTarget.Count
         For Each iCell In iTarget
             iCount& = iCount& + 1
             .StatusBar = "Выполнено : " & _
             .Round(iCount& * iProcent#, 0) & "%"
         Next
         .StatusBar = False
    End With
End Sub

Private Sub MyStatusBar2()
    With ThisWorkbook.Worksheets(1).Range("A1:A10000")
         'Используйте свой диапазон, содержащий не менее 100 ячеек
         iProcent& = .Count / 100
         Dim iCell As Range '''''
         For Each iCell In .Cells
             iCount& = iCount& + 1
             Application.StatusBar = "Выполнено : " & _
             iCount& \ iProcent& & "%"
         Next
    End With
    Application.StatusBar = False
End Sub

Leave a Comment