VBA To Create (But Not To Send) E-mail Drafts Based On Table

CyrusTheVirus

Well-known Member
Joined
Jan 28, 2015
Messages
749
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

Looking for a code that will populate e-mail drafts within outlook, but not send them out, based on information within a table. The table name is Email_Table, and the sheet is Sheet1.

Specifically, what I need to populate within the e-mail is:

1) The subject which is in cell B1.

2) The body, which is in cell B2, but I need the body to be two lines below "Hi (insert first name of supervisor (only one time) from column 1 of Email_Table),".

3) Headers from table (copy/pasted), with corresponding data per supervisor (copy/pasted), but ONLY for table columns 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 17... to clarify I need one e-mail to be drafted for each supervisor listing out all of their items, the below example shows some supervisors with 1 item, 2 items, and 4 items. Below is an example of what Sheet1 looks like, and below that is an example of the 4 e-mails that I would want populated (but not sent, so drafted) within outlook.

Can anyone please help with this?


[TABLE="width: 1957"]
<tbody>[TR]
[TD]Subject:[/TD]
[TD]Outstanding Items[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Body:[/TD]
[TD="colspan: 6"]The below item(s) are outstanding. If these are already resolved, then please ignore this e-mail. Also, please let me know if you need assistance with this.[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Email_Table[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]First Name[/TD]
[TD]Supervisor E-mail Address[/TD]
[TD]Supervisor Name[/TD]
[TD]Employee Name[/TD]
[TD]Hourly/Salary[/TD]
[TD]Employee No.[/TD]
[TD]Employee Info[/TD]
[TD]Pin[/TD]
[TD]Location No.[/TD]
[TD]Location Name[/TD]
[TD]Date In[/TD]
[TD]Time In[/TD]
[TD]Date Out[/TD]
[TD]Time Out[/TD]
[TD]Requested Date[/TD]
[TD]Options[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]Anne[/TD]
[TD]AApple@123.org[/TD]
[TD]Apple, Amanda[/TD]
[TD]Smith, John[/TD]
[TD]Hourly[/TD]
[TD="align: right"]1235[/TD]
[TD]Smith, John[/TD]
[TD="align: right"]600[/TD]
[TD]009012[/TD]
[TD]Accounting[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/6/2019[/TD]
[TD]12:04:26[/TD]
[TD][/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Kelli[/TD]
[TD]KBlacksmith@123.org[/TD]
[TD]Blacksmith, Kelli[/TD]
[TD]Rogers, Andrea[/TD]
[TD]Salary[/TD]
[TD="align: right"]5168[/TD]
[TD]Rogers, Andrea[/TD]
[TD="align: right"]100[/TD]
[TD]002000[/TD]
[TD]HR[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]07:54:55[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]George[/TD]
[TD]GCurry@123.org[/TD]
[TD]Curry, George[/TD]
[TD]Salem, Travis[/TD]
[TD]Hourly[/TD]
[TD="align: right"]54545[/TD]
[TD]Salem, Travis[/TD]
[TD="align: right"]301[/TD]
[TD]002600[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/11/2019[/TD]
[TD]13:21:38[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]George[/TD]
[TD]GCurry@123.org[/TD]
[TD]Curry, George[/TD]
[TD]Salem, Travis[/TD]
[TD]Hourly[/TD]
[TD="align: right"]66464[/TD]
[TD]Salem, Travis[/TD]
[TD="align: right"]102[/TD]
[TD]009102[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]13:16:32[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Michelle[/TD]
[TD]MMiller@123.org[/TD]
[TD]Miller, Michelle[/TD]
[TD]Russell, Corey[/TD]
[TD]Hourly[/TD]
[TD="align: right"]848[/TD]
[TD]Russell, Corey[/TD]
[TD="align: right"]102[/TD]
[TD]009102[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]12:33:04[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Michelle[/TD]
[TD]MMiller@123.org[/TD]
[TD]Miller, Michelle[/TD]
[TD]Russell, Corey[/TD]
[TD]Salary[/TD]
[TD="align: right"]848[/TD]
[TD]Russell, Corey[/TD]
[TD="align: right"]311[/TD]
[TD]002802[/TD]
[TD]House[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]10:15:01[/TD]
[TD][/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Michelle[/TD]
[TD]MMiller@123.org[/TD]
[TD]Miller, Michelle[/TD]
[TD]Smith, Sean[/TD]
[TD]Salary[/TD]
[TD="align: right"]545[/TD]
[TD]Smith, Sean[/TD]
[TD="align: right"]311[/TD]
[TD]002802[/TD]
[TD]House[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]10:15:01[/TD]
[TD][/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Michelle[/TD]
[TD]MMiller@123.org[/TD]
[TD]Miller, Michelle[/TD]
[TD]Tompkins, Brian[/TD]
[TD]Salary[/TD]
[TD="align: right"]949[/TD]
[TD]Tompkins, Brian[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD="align: right"]3[/TD]
[TD]Calendar Request Pending Approval[/TD]
[/TR]
</tbody>[/TABLE]




[TABLE="width: 1016"]
<tbody>[TR]
[TD]Hi Amanda,[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 12"]The below item(s) are outstanding. If these are already resolved, then please ignore this e-mail. Also, please let me know if you need assistance with this.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supervisor Name[/TD]
[TD]Employee Name[/TD]
[TD]Hourly/Salary[/TD]
[TD]Pin[/TD]
[TD]Location No.[/TD]
[TD]Location Name[/TD]
[TD]Date In[/TD]
[TD]Time In[/TD]
[TD]Date Out[/TD]
[TD]Time Out[/TD]
[TD]Requested Date[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]Apple, Amanda[/TD]
[TD]Smith, John[/TD]
[TD]Hourly[/TD]
[TD="align: right"]600[/TD]
[TD]009012[/TD]
[TD]Accounting[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/6/2019[/TD]
[TD]12:04:26[/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Hi Kelli,[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 12"]The below item(s) are outstanding. If these are already resolved, then please ignore this e-mail. Also, please let me know if you need assistance with this.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supervisor Name[/TD]
[TD]Employee Name[/TD]
[TD]Hourly/Salary[/TD]
[TD]Pin[/TD]
[TD]Location No.[/TD]
[TD]Location Name[/TD]
[TD]Date In[/TD]
[TD]Time In[/TD]
[TD]Date Out[/TD]
[TD]Time Out[/TD]
[TD]Requested Date[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]Blacksmith, Kelli[/TD]
[TD]Rogers, Andrea[/TD]
[TD]Salary[/TD]
[TD="align: right"]100[/TD]
[TD]002000[/TD]
[TD]HR[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]07:54:55[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Hi George,[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 12"]The below item(s) are outstanding. If these are already resolved, then please ignore this e-mail. Also, please let me know if you need assistance with this.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supervisor Name[/TD]
[TD]Employee Name[/TD]
[TD]Hourly/Salary[/TD]
[TD]Pin[/TD]
[TD]Location No.[/TD]
[TD]Location Name[/TD]
[TD]Date In[/TD]
[TD]Time In[/TD]
[TD]Date Out[/TD]
[TD]Time Out[/TD]
[TD]Requested Date[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]Curry, George[/TD]
[TD]Salem, Travis[/TD]
[TD]Hourly[/TD]
[TD="align: right"]301[/TD]
[TD]002600[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/11/2019[/TD]
[TD]13:21:38[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Curry, George[/TD]
[TD]Salem, Travis[/TD]
[TD]Hourly[/TD]
[TD="align: right"]102[/TD]
[TD]009102[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]13:16:32[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Hi Michelle,[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 12"]The below item(s) are outstanding withim. If these are already resolved, then please ignore this e-mail. Also, please let me know if you need assistance with this.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Supervisor Name[/TD]
[TD]Employee Name[/TD]
[TD]Hourly/Salary[/TD]
[TD]Pin[/TD]
[TD]Location No.[/TD]
[TD]Location Name[/TD]
[TD]Date In[/TD]
[TD]Time In[/TD]
[TD]Date Out[/TD]
[TD]Time Out[/TD]
[TD]Requested Date[/TD]
[TD]Notes[/TD]
[/TR]
[TR]
[TD]Miller, Michelle[/TD]
[TD]Russell, Corey[/TD]
[TD]Hourly[/TD]
[TD="align: right"]102[/TD]
[TD]009102[/TD]
[TD]Warehouse[/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]12:33:04[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Call Out Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Miller, Michelle[/TD]
[TD]Russell, Corey[/TD]
[TD]Salary[/TD]
[TD="align: right"]311[/TD]
[TD]002802[/TD]
[TD]House[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]10:15:01[/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Miller, Michelle[/TD]
[TD]Smith, Sean[/TD]
[TD]Salary[/TD]
[TD="align: right"]311[/TD]
[TD]002802[/TD]
[TD]House[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]10:15:01[/TD]
[TD][/TD]
[TD]Call In Missing or Not Approved[/TD]
[/TR]
[TR]
[TD]Miller, Michelle[/TD]
[TD]Tompkins, Brian[/TD]
[TD]Salary[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2/12/2019[/TD]
[TD]Calendar Request Pending Approval[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
What msgbox?? Need to see the code.

You might have a look at the locals window, too.
Or google to understand arrays.

Or look at the codes posted.
Or germane to your post,
aFieldsToKeep = Array(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 17)

For i = LBound(aFieldsToKeep) To UBound(aFieldsToKeep)
debug.print i, Columns(aFieldsToKeep(i)
Next i
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
need to fix that last bit of code I posted,

aFieldsToKeep = Array(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 17)

For i = LBound(aFieldsToKeep) To UBound(aFieldsToKeep)
debug.print i, aFieldsToKeep(i)
Next i
 
Upvote 0
Hey Fazza,

What I'm asking is if we take the below example the MsgBox pulls 0, 1, 2 when the array is 3, 5, 7. Of Course it correctly takes columns 3, 5, 7 when referencing, but how does it know to pull 3, 5, 7 when it is being delivered 0, 1, 2 ?

Sub ArrayTest()


Dim i As Long
Dim MyArray As Variant


MyArray = Array(3, 5, 7)


For i = LBound(MyArray) To UBound(MyArray)


MsgBox i


Next i
 
Upvote 0
MyArray = Array(3, 5, 7)

the elements are addressed,
MyArray(0) - which is 3
MyArray(1) - which is 5
MyArray(2) - which is 7

you can see this in the VBE's (Visual Basic Editor) local windows. if you don't know what this is, please google

Also google to understand arrays

I'll repeat my prior post,

[/code]
Rich (BB code):
aFieldsToKeep = Array(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 17)

For i = LBound(aFieldsToKeep) To UBound(aFieldsToKeep)
debug.print i, aFieldsToKeep(i)
Next i


OK?
 
Upvote 0
MyArray = Array(3, 5, 7)

the elements are addressed,
MyArray(0) - which is 3
MyArray(1) - which is 5
MyArray(2) - which is 7

you can see this in the VBE's (Visual Basic Editor) local windows. if you don't know what this is, please google

Also google to understand arrays

I'll repeat my prior post,

[/code]
Rich (BB code):
aFieldsToKeep = Array(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15, 17)

For i = LBound(aFieldsToKeep) To UBound(aFieldsToKeep)
debug.print i, aFieldsToKeep(i)
Next i


OK?

All good. Thank you for your time Fazza.
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,019
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top