Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109917 > unrolled thread

help with loop code

Started byeltyar <eltyar.130f09d8@excelbanter.com>
First post2017-03-15 14:24 +0000
Last post2017-03-16 06:43 +0000
Articles 3 — 3 participants

Back to article view | Back to microsoft.public.excel.programming


Contents

  help with loop code eltyar <eltyar.130f09d8@excelbanter.com> - 2017-03-15 14:24 +0000
    Re: help with loop code Claus Busch <claus_busch@t-online.de> - 2017-03-15 16:05 +0100
      Re: help with loop code eltyar <eltyar.130fead8@excelbanter.com> - 2017-03-16 06:43 +0000

#109917 — help with loop code

Fromeltyar <eltyar.130f09d8@excelbanter.com>
Date2017-03-15 14:24 +0000
Subjecthelp with loop code
Message-ID<eltyar.130f09d8@excelbanter.com>
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"




-- 
eltyar

[toc] | [next] | [standalone]


#109918

FromClaus Busch <claus_busch@t-online.de>
Date2017-03-15 16:05 +0100
Message-ID<oabl27$79n$1@dont-email.me>
In reply to#109917
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

[toc] | [prev] | [next] | [standalone]


#109920

Fromeltyar <eltyar.130fead8@excelbanter.com>
Date2017-03-16 06:43 +0000
Message-ID<eltyar.130fead8@excelbanter.com>
In reply to#109918
Dear Claus
thanks i appreciate your replay

here is my all code (this code to send emails directly to my customers
from excel) because when i added yours it's not working

Code:
Sub sendmail()
i = 4
Do


EmailTo = Cells(i, "J").Value
CCto = Cells(i, "K").Value
Subj = Cells(i, "L").Value
Filepath = Cells(i, "M").Value
msg = Cells(i, "N").Value


Application.DisplayAlerts = False

Dim OutApp As Object
Dim OutMail As Object
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

SigString = Environ("appdata") & _
"\Microsoft\Signatures\mrm.htm"

If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
To = EmailTo
CC = CCto
BCC = ""
Subject = Subj
HTMLBody = msg & "<br>" & Signature
'.body = msg & vbNewLine & vbNewLine & Signature
Attachments.Add Filepath
Display    '.Send   'or use .Display

End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing



Application.DisplayAlerts = True

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


End Sub


thanks again for ur kind help




-- 
eltyar

[toc] | [prev] | [standalone]


Back to top | Article view | microsoft.public.excel.programming


csiph-web