Macro to copy specific columns from one workbook into a blank one and then open a second workbook to copy the same columns.

leo_22

New Member
Joined
May 10, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello all,
I need help with a problem which I'm trying to implement using VBA code but unfortunately due to lack of practice and knowledge about coding I'm not able to get the desired output.

The problem is given below:
1) A macro which can open a workbook and copy the data within the columns "B","D","G","N" and "Q" along with the column headers and paste those in a new(Blank) workbook.

2) Then the macro will open another workbook (similar to the previous one) and copy the same columns as mentioned in step 1 but without the column headers and paste it in the first empty cell below the data pasted as part of step 1.

Request anyone with the solution to this problem to please help me out.

A sample reference sheet with some data has been attached:

ir211wk12sample.xls
ABCDEFGHIJKLMNOPQ
1Sr No.OrderDateRegionRepItemUnitsUnit CostTotalBinsFrequencyIntervalsItem TypeFrequencyRel. Freq% Freq.IntervalsIntervals
219-1-14CentralSmithDesk2125.00250.00960-9Pencil130.30232558130.2%0-90-9
326-17-15CentralKivellDesk5125.00625.00194Oct-19Binder150.34883720934.9%Oct-19Oct-19
439-10-15CentralGillPencil71.299.0329420-29Pen50.1162790711.6%20-2920-29
5411-17-15CentralJardineBinder114.9954.8939330-39Pen Set70.16279069816.3%30-3930-39
6510-31-15CentralAndrewsPencil141.2918.0649240-49Desk30.0697674427.0%40-4940-49
762-26-14CentralGillPen2719.99539.7359650-59431100.0%50-5950-59
8710-5-14CentralMorganBinder288.99251.7269660-6960-6960-69
9812-21-15CentralAndrewsBinder284.99139.7279370-7970-7970-79
1092-9-14CentralJardinePencil364.99179.6489380-89Oct-1980-8980-89
11108-7-15CentralKivellPen Set4223.951,005.9099690-9990-9990-99
12111-15-15CentralGillBinder468.99413.540100+100+100+
13121-23-14CentralKivellBinder5019.99999.50960-9Pencil130.30232558130.2%0-90-9
14133-24-15CentralJardinePen Set504.99249.50194Oct-19Binder150.34883720934.9%Oct-19Oct-19
15145-14-15CentralGillPencil531.2968.3729420-29Pen50.1162790711.6%20-2920-29
16157-21-15CentralMorganPen Set5512.49686.9539330-39Pen Set70.16279069816.3%30-3930-39
17164-10-15CentralAndrewsPencil661.99131.3449240-49Desk30.0697674427.0%40-4940-49
181712-12-14CentralSmithPencil671.2986.4359650-59431100.0%50-5950-59
19184-18-14CentralAndrewsPencil751.99149.2569660-6960-6960-69
20195-31-15CentralGillBinder808.99719.2079370-7970-7970-79
21202-1-15CentralSmithBinder8715.001,305.0089380-89Oct-1980-8980-89
22215-5-14CentralJardinePencil904.99449.1099690-9990-9990-99
23226-25-14CentralMorganPencil904.99449.100100+100+100+
242312-4-15CentralJardineBinder9419.991,879.0660-9Pencil130.30232558130.2%0-90-9
252411-25-14CentralKivellPen Set964.99479.044Oct-19Binder150.34883720934.9%Oct-19Oct-19
26252-18-15EastJonesBinder44.9919.96420-29Pen50.1162790711.6%20-2920-29
272611-8-14EastParentPen1519.99299.85330-39Pen Set70.16279069816.3%30-3930-39
28279-18-14EastJonesPen Set1615.99255.84240-49Desk30.0697674427.0%40-4940-49
29287-12-14EastHowardBinder291.9957.71650-59431100.0%50-5950-59
30298-15-14EastJonesPencil354.99174.65660-6960-6960-69
31304-1-14EastJonesBinder604.99299.40370-7970-7970-79
32316-8-14EastJonesBinder608.99539.40380-89Oct-1980-8980-89
33327-4-15EastJonesPen Set624.99309.38690-9990-9990-99
343310-22-14EastJonesPen648.99575.360100+100+100+
353412-29-14EastParentPen Set7415.991,183.2660-9Pencil130.30232558130.2%0-90-9
36357-29-14EastParentBinder8119.991,619.194Oct-19Binder150.34883720934.9%Oct-19Oct-19
37361-6-14EastJonesPencil951.99189.05420-29Pen50.1162790711.6%20-2920-29
38374-27-15EastHowardPen964.99479.04330-39Pen Set70.16279069816.3%30-3930-39
39388-24-15WestSorvinoDesk3275.00825.00240-49Desk30.0697674427.0%40-4940-49
40393-7-15WestSorvinoBinder719.99139.93650-59431100.0%50-5950-59
41405-22-14WestThompsonPencil321.9963.68660-6960-6960-69
42413-15-14WestSorvinoPencil562.99167.44370-7970-7970-79
434210-14-15WestThompsonBinder5719.991,139.43380-89Oct-1980-8980-89
44439-27-15WestSorvinoPen761.99151.24690-9990-9990-99
SalesOrders
Cell Formulas
RangeFormula
H2:H44H2=G2*F2
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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