I am new to Excel VBA, and to this forum, and I have a query that is driving me mad.
I have one column of names in
excel. The column may contain more than one row with the same name but these rows with the same name will all be grouped
together. This is an exampe (each name represents a row in column A):
What I want to do is copy the rows with the same information, e,g, the rows with 'julie' above,
paste them into a new spreadsheet and email this spreadsheet to specific email addresses and then do the same for 'jonathan'.
I can work out how to send an email using VBA but I am really stuck as to how to go through the rows and send the
email in discrete 'chunks'. I have tried using a for next loop, looping through the rows and copying/pasting rows that are
the same as the previous one into a new spreadsheet but this does it one row at a time.
If I include the instruction to email the spreadsheet within the loop this would also email the new spreadsheet one row of
information at a time, i.e. three emails for 'julie' each containing a spreadsheet with one row of information on it, rather
than one email containing one spreadsheet with all three rows on it.
I hope I have clearly explained what I am
trying to do. I realise this has probably been asked countless times before (and I apologise if it has) but I have Googled
this topic countless times in the last couple of weeks but, because I don't know that much about VBA, I haven't been able to
find any help on my own.
I suspect using a for next loop is not the way to do this but I can't think of any other
way. I would be really grateful for any advice anyone could give.
My code to copy and paste the data into the new
for i = 1 to numrows
if worksheets("Sheet1").cells(i,1) =
Instructions to create new workbook and email go here