Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

The implementation of the action requires the following actions - "Open", "Run external macro", “Message”, “Save”, “Close”.

...

4. Learn more about creating a macro here: Creating and running Create or run a macro.

Example of a macro

Блок кода
languagevb
linenumberstrue
Function TestMonth() As Long
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim currentMonthYear As String
    Dim cell As Range
    Dim counter As Long
    Set ws = ActiveSheet
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    currentMonthYear = Format(Now, "MM.YY")
    counter = 0
    For Each cell In ws.Range("A1:A" & lastRow)
        Dim cellMonthYear As String
        cellMonthYear = Format(cell.Value, "MM.YY")
        If cellMonthYear <> currentMonthYear Then
            counter = counter + 1
            cell.Interior.Color = RGB(255, 0, 0)
        End If
    Next cell
    TestMonth = counter
End Function

...

8. Press the "Start" button and see the result. 

Results

Macro ran successfully