Iterating through columns in VBA (Excel) -


When I typed that title, I found it in topics of help and saw some of them and some basic ideas Received. I am still stuck and this is the reason that to get some guidance, prepare a new post.

The scenario is:

In my Excel sheet, the letter Y or N is in A1, some text in B1 and valid future date in C1.

I currently have a VBA script that does this for a line:

It checks that (in the date C1-15 days) is today's date and after that Check whether A1N is If these two conditions are correct, then send an automated e-mail.

I do not know, how can I work it for a number of rows?

Here's what I have now

  Sub-SendAlert () Set the items required for automation in lotus notes 'Dim mailboxes as objects' In the form of the user name string 'Current user names name Dim MailDbName as String' Current those mail databases name as dirty maildoc object Note 'mail self document dull AttachME object' attachment richtextfile dim session object object notes session slow EmbedObj object As the In the form of an 'embedded object' (attachment) as a dim stSignature string dim, I start the session for notes in the form of an integer 'Set session for session' 'Set CreateObject for session ("Notes.NotesSession") 'Get the username of the session and then calculate the mail file name' You may or may not need this for MailBean with some systems that you can pass by using an empty string pass User Name = session. Username MailDbName = Left $ (username, 1) & amp; Correct $ (username, (lane (username) - INSAT (1, username, ""))) & amp; If the ".nsf" file is already open for Maildb.OPENMAIL termination, then set the 'Set Up New Mail Document Set MailDoc' Maildb = Session.GETDATABASE ("", MailDbName) if Maildb.IsOpen = True Note in Mail Databases Open '= Maildb.CREATEDOCUMENT MailDoc.Form = "Memo"' Flags can send mail to installation or not mSend = 0 'to copy cells - as the deadline date cStatus = cStatus & amp; Working as pending cell C1 position, cell B1 being copied Cell A1; Room (1, 1) Message = Message & amp; Cells (1, 2) dDate = dDate & amp; Cells (1, 3) ** Looking Through Cells ** Previous Line = ActiveSite Range used Special Call (XLSL Type List Cell). ' Last Line Number Gates I = 1 to Last & amp; Cell (i, 1) = "N" 'Attach your signature =' submit ', & amp; VbCrLf & amp; "Some names" 'MailDoc.Recipient = Recipient addressee = "someemailaddress@yahoo.com," Recipient = Split (Recipients, ",) MailDoc.sendto = Recipient' MailDoc.Subject = Theme MailDoc.Subject = ' "'Mail Doc. Body = bodytext mail doc. Body = 'Dear Naxc Team,' & amp; VbCrLf & amp; VbCrLf & amp; "There are pending activities here:" & amp; VbCrLf & amp; VbCrLf & amp; Message & amp; VbCrLf & amp; VbCrLf & amp; If the sender send the document 'MailDoc.SAVEMESSAGEONSEND = SaveIt MailDoc.SAVEMESSAGEONSEND = true' (DATEADD ("D", -15, dDate) = date) and (cStatus = "N") then MailDoc.SEND, recipient, then the end ' Set Up Clean Up Maildb = None Set MailDoc = None Set Attachment = None Set Session = None Set Embed Obj = No End Sub  

I do not understand looking through the cells. I also have the argument ..

  1. Check all cells (i, 3) where I have the last non-empty line from 1.
  2. Date efficiency - every data in the cell for 15 days (i, 3).
  3. If any of these matches today, then check the same (i, 1) column.
  4. If that particular (i, 1) is set to N, trigger the e-mail.

I have a mSend flag that will be 0 in the beginning. If the 4th position is satisfied, then I will set it to 1 and then check the mSend value before triggering the e-mail.

Anybody please guide.

I understand myself :)

  lastRow = ActiveSheet.UsedRange.SpecialCells (xlCellTypeLastCell) .Row 'last line number I = 1 to last I; Cell (i, 2) end if end if next  

Thanks!


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -