I have the code below and it all works well with MyCopy10. But the next code MyCopy100 is not copying the data in last row of sheet Actual Email. I am not sure as were problem is.
Code:
Sub MyCopy10()
Dim myCols As Variant
Dim lastRow As Long
Dim c As Long
Sheets("Eamil-10").Activate
'Set columns you want to loop through in an array
myCols = Array("A", "B", "C", "D")
' Loop through columns array
For c = LBound(myCols) To UBound(myCols)
' Find last row in column A with data
lastRow = Sheets("Eamil-10").Cells(Rows.Count, myCols(c)).End(xlUp).Row
' Copy data from Email-10 sheet to Actual Email
Sheets("Eamil-10").Range(Cells(1, myCols(c)), Cells(lastRow, myCols(c))).Copy
Sheets("Actual Email").Cells(1, c + 1).PasteSpecial Paste:=xlValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Next c
' Sheets("Summary").Activate
End Sub
Code:
Sub MyCopy100()
Dim myCols As Variant
Dim lastRow As Long
Dim c As Long
Sheets("Email-100").Activate
' Set columns you want to loop through in an array
myCols = Array("A", "B", "C", "D")
' Loop through columns array
For c = LBound(myCols) To UBound(myCols)
' Find last row in column A with data
lastRow = Sheets("Email-100").Cells(Rows.Count, myCols(c)).End(xlUp).Row
' Copy data from Email-100 sheet to Actual Email
Sheets("Email-100").Range(Cells(1, myCols(c)), Cells(lastRow, myCols(c))).Copy
Sheets("Actual Email").Cells(1, c + 1).PasteSpecial Paste:=xlValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Next c
' Sheets("Summary").Activate
End Sub
Code:
Sub MyCopy10()
Dim myCols As Variant
Dim lastRow As Long
Dim c As Long
Sheets("Eamil-10").Activate
'Set columns you want to loop through in an array
myCols = Array("A", "B", "C", "D")
' Loop through columns array
For c = LBound(myCols) To UBound(myCols)
' Find last row in column A with data
lastRow = Sheets("Eamil-10").Cells(Rows.Count, myCols(c)).End(xlUp).Row
' Copy data from Email-10 sheet to Actual Email
Sheets("Eamil-10").Range(Cells(1, myCols(c)), Cells(lastRow, myCols(c))).Copy
Sheets("Actual Email").Cells(1, c + 1).PasteSpecial Paste:=xlValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Next c
' Sheets("Summary").Activate
End Sub
Code:
Sub MyCopy100()
Dim myCols As Variant
Dim lastRow As Long
Dim c As Long
Sheets("Email-100").Activate
' Set columns you want to loop through in an array
myCols = Array("A", "B", "C", "D")
' Loop through columns array
For c = LBound(myCols) To UBound(myCols)
' Find last row in column A with data
lastRow = Sheets("Email-100").Cells(Rows.Count, myCols(c)).End(xlUp).Row
' Copy data from Email-100 sheet to Actual Email
Sheets("Email-100").Range(Cells(1, myCols(c)), Cells(lastRow, myCols(c))).Copy
Sheets("Actual Email").Cells(1, c + 1).PasteSpecial Paste:=xlValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Next c
' Sheets("Summary").Activate
End Sub
Last edited: