Hi everyone! First of all, I appreciate the help! I amworking on a project for work and have never used VBA before so everything I amlearning is from these forum and YouTube videos. We have a large spreadsheetfor work where anyone can put a PO request in. These requests include theindividuals name, project descriptions, as well as other information relatingto the project. I am trying to send out only 5 of the 25 columns in an emailusing Outlook. To start off with my code, I am just trying to learn how to copythe desired cells. Through this forum, I have learned how to copy and paste the entirerow. Is there a way to copy all of the rows with only the columns I want? I have copied and pastedmy code below! Thanks again for your help.
Sub CopyData()
a = Worksheets("Active").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a 'for each row between 2 and the final row with data
If Worksheets("Active").Cells(i, 3).Value = "Michael" Then
Worksheets("Active").Rows(i).Copy
Worksheets("Sheet3").Activate
b = Worksheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet3").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Active").Activate
End If
Next
End Sub
Sub CopyData()
a = Worksheets("Active").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a 'for each row between 2 and the final row with data
If Worksheets("Active").Cells(i, 3).Value = "Michael" Then
Worksheets("Active").Rows(i).Copy
Worksheets("Sheet3").Activate
b = Worksheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet3").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Active").Activate
End If
Next
End Sub