I can't seem to get excel 2013 to recognize some of my objects properly, especially when I am trying to pass values, please help! This sub is supposed to take a list of purchasers in single rows and separate them out to individual rows so they can be used in a mail merge.
Am especially having trouble with this line, I want to take a range and simply copy it to range in the next sheet based on where the counter is in the loop:
Sheets(2).Range(Cells(mergeRow, 1), Cells(mergeRow, 7)) = Sheets(1).Range(Cells(i, 5), Cells(i, 11))
Sub UTWMailMerge2()
'
'1: Loop through each row and see if there is a recipient address 1, recipient address 2, or recipient address 3
'2: If none, use purchaser address
'3: Take information and display on new line for each recipient in row
Dim i As Integer
Dim lastRow As Integer
Dim mergeRow As Integer
mergeRow = 1
lastRow = Range("A" & Rows.Count).End(xlUp).Row
'Loop through each row and see if there is a recipient address 1, recipient address 2, or recipient address 3
For i = 2 To lastRow
If Not IsEmpty(Sheets(1).Cells(i, 7).Value) Then
'I keep receiving an error on this below
Sheets(2).Range(Cells(mergeRow, 1), Cells(mergeRow, 7)) = Sheets(1).Range(Cells(i, 5), Cells(i, 11))
mergeRow = mergeRow + 1
End If
Next i
End Sub
Any help would be appreciated, thanks!
Jordan
Bookmarks