Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

What does the 'lastRow - 9' mean in this code: Application.ScreenUpdating = False Dim i…

  1. User

    What does the 'lastRow - 9' mean in this code: Application.ScreenUpdating = False Dim i As Long, lastRow As Long Dim startRow As Long lastRow = Cells(Rows.count, "A").End(xlUp).Row 'find last row with data in column A startRow = lastRow - 9 'calculate row to start the calculation If startRow < 1 Then startRow = 1 'ensure start row is not less than 1 'loop through all rows from startRow to lastRow and force a calculate on columns A to M For i = startRow To lastRow Range("A" & i & ":M" & i).Calculate Next i Application.ScreenUpdating = True

  2. Assistant

    The expression 'lastRow - 9' calculates the row number from which the loop should start. It subtracts 9 from the row number of the last cell with data in column A, which means that the loop will calculate formulas in columns A to M starting from 9 rows above the last data row. This likely means that the last 9 rows in the worksheet contain some sort of summary information that should not be changed by the calculation.