Показать положительное число в столбце
Проблема вашего кода может заключаться в том, что вы «делаете», пока «» не появится в столбце A , но вы показываете значения столбца Q , например если A2 не больше 0, окна сообщений не будут.
Для следующей версии
Sub ShowPositive()
Const cSheet As Variant = "Sheet1" ' Worksheet Name/Index
Const cFirstR As Integer = 1 ' First Row Number
Const cColumn As Variant = 17 ' Column Letter/Number e.g. "Q" or 17
Dim lastR As Long ' Last Row Number
Dim i As Long ' Row Counter
With ThisWorkbook.Worksheets(cSheet)
' Calculate Last Row Number.
lastR = .Cells(.Rows.Count, cColumn).End(xlUp).Row
' Loop through all rows.
For i = cFirstR To LastR
' Check if current cell contains a number AND
' if it is greater than 0.
If IsNumeric(.Cells(i, cColumn)) And .Cells(i, cColumn) > 0 _
Then MsgBox .Cells(i, cColumn)
Next
End With
End Sub
Версия Do Loop
Sub ShowPositive2()
Const cSheet As Variant = "Sheet1" ' Worksheet Name/Index
Const cFirstR As Integer = 1 ' First Row Number
Const cColumn As Variant = 17 ' Column Letter/Number e.g. "Q" or 17
Dim n As Long ' Row Counter
With ThisWorkbook.Worksheets(cSheet)
n = cFirstR ' To skip First Row.
Do Until .Cells(n + 1, cColumn) = ""
n = n + 1
If IsNumeric(.Cells(n, cColumn)) And .Cells(n, cColumn) > 0 _
Then MsgBox .Cells(n, cColumn)
Loop
End With
End Sub