Copy Paste Multiple Columns To Another Sheet

unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,

Need some help here. So I have a workbook with filename "Master Data" with tab sheets namely "Main File" and "Final".

Main File Data look like this"

NameStat 1Stat 2 PrevStatSubject1Subject2 Subject 3
Eve9610MathSciencePE
Mon7515HistoryPEGeo
Sam478PEMathPolSci
Belle426MathScieneHistory

<tbody>
</tbody>


I'm looking for the codes where the macro will copy the data from the "Master Data" to "Final" tab and the result will look like below.
By the way, the "Current Stat" is the result of summing up "Stat1" and "Stat 2"

NameSubject1Subject2Subject3Current StatPrevStat
EvenMath SciencePE1510
MonHistoryPEGeo1215
SamPEMathPolSci118
BelleMathScienceHistory66

<tbody>
</tbody>


Any help will be much appreciated.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try this:
Code:
Sub Test()
'Modified 6/29/2018 5:12 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Sheets("Main File").Activate
Dim Lastrow As Long
Lastrow = Sheets("Final").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Final").Cells(1, 1).Resize(Lastrow, 6).ClearContents
Lastrow = Sheets("Main File").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Main File").Cells(1, "A").Resize(Lastrow).Copy Sheets("Final").Cells(1, 1)
Lastrow = Sheets("Main File").Cells(Rows.Count, "E").End(xlUp).Row
Sheets("Main File").Cells(1, "E").Resize(Lastrow, 3).Copy Sheets("Final").Cells(1, 2)
Lastrow = Sheets("Main File").Cells(Rows.Count, "D").End(xlUp).Row
Sheets("Main File").Cells(1, "D").Resize(Lastrow).Copy Sheets("Final").Cells(1, "F")
Sheets("Final").Cells(1, "E").Value = "Current Stat"
Lastrow = Sheets("Main File").Cells(Rows.Count, "B").End(xlUp).Row
For i = 2 To Lastrow
Sheets("Final").Cells(i, "E").Value = Cells(i, "b").Value + Cells(i, "C").Value
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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