Hello:
I need some help please with creating a VBA sub procedure. I need to create an If/Thenloop that copies data from field A2 of one worksheet, goes to another worksheetand paste the data in cell S2, calls another sub procedure and then repeatsthese steps. I’ve explained it a little more below:
I have a workbook with two worksheets; “Auth Form” and “Contacts”. The “Contacts”worksheet has contact names in column A and contact emails in column B. I needto create an If Then Loop where if the field in column A of the “Contacts”worksheet is not blank, the data is copied from that field and paste in fieldS2 of the “Auth Form” worksheet. The sub procedure would then call another subprocedure to execute. Once the other sub procedure has executed, it would returnto the Contacts” worksheet, move to cell A3, repeat the copy/paste to field S2of the “Auth Form” worksheet and then call the other sub procedure to executeagain. This would continue until it encountered a blank field in column A. Here’swhat I have come up with:
Sub Email_Loop()
Dim i As Long
i = 1
Do While Cells(i,"A").Value <> ""
If Cells(i,"A").Value <> "" Then
‘Don’t know what to put here to copy the data and paste itinto cell S2 it into the other worksheet’
Call Mail_ActiveSheet
End If
i = i + 1
Loop
I need some help please with creating a VBA sub procedure. I need to create an If/Thenloop that copies data from field A2 of one worksheet, goes to another worksheetand paste the data in cell S2, calls another sub procedure and then repeatsthese steps. I’ve explained it a little more below:
I have a workbook with two worksheets; “Auth Form” and “Contacts”. The “Contacts”worksheet has contact names in column A and contact emails in column B. I needto create an If Then Loop where if the field in column A of the “Contacts”worksheet is not blank, the data is copied from that field and paste in fieldS2 of the “Auth Form” worksheet. The sub procedure would then call another subprocedure to execute. Once the other sub procedure has executed, it would returnto the Contacts” worksheet, move to cell A3, repeat the copy/paste to field S2of the “Auth Form” worksheet and then call the other sub procedure to executeagain. This would continue until it encountered a blank field in column A. Here’swhat I have come up with:
Sub Email_Loop()
Dim i As Long
i = 1
Do While Cells(i,"A").Value <> ""
If Cells(i,"A").Value <> "" Then
‘Don’t know what to put here to copy the data and paste itinto cell S2 it into the other worksheet’
Call Mail_ActiveSheet
End If
i = i + 1
Loop