View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default help with loop code

Hi,

Am Wed, 15 Mar 2017 14:24:06 +0000 schrieb eltyar:

please how can i say in this code... do it when you see "ok" in cells of
column "P" and if any empty cells ignore it and continue?

this is the Code:

I = I + 1
Cells(1, "J").Value = "Outlook sent Time,Dynamic msg preview count ="
& I - 3
Loop While Cells(I, "P").Value = "ok"


try:

Sub Test()
Dim LRow As Long
Dim i As Long, j As Long
j = 1
With ActiveSheet
LRow = .UsedRange.Rows.Count
For i = 1 To LRow
If .Cells(i, "P") = "ok" Then
.Cells(i, "J") = _
"Outlook sent Time,Dynamic msg preview count =" & j - 3
j = j + 1
End If
Next
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016