Macro to IF A=x, COPY/PASTE TO sheet1, A=y, sheet2

Artorius

Board Regular
Joined
Apr 18, 2006
Messages
176
Worksheet 1, columns A to G contain raw data.

Column A only contains a number 1 to 10 inclusively.

I'd like to create a MACRO button that when pressed will do the following:-

IF A = 1, copy paste that row of data to Sheet1,
IF A = 2, copy paste that row of data to Sheet2
etc to A = 10 ..... sheet10.

As far as macro's go ... I'm guessing that this will be a fairly easy task and I'm interested to see the structure of the VBA coding so that I can use something similar in some other macro's that I need to do.

Thanks in advance.
 
OK ..... people are moving goalposts now :)

I have 2 additional requirements if someone can help ......

PART1 - Delete blank Columns in Sheet1 to 10

From the RAW DATA, only Columns C, F,G,H have data in that they want copied. So ... thats fine, I've just left out the titles. In Sheets 1 to 10 .... I now have columns A,B, D,E that are BLANK.

I'd like to create a line of code that will delete the Columns between A to G that contain NO data

PART2 - Print All records

I'd then like the macro to PRINT each sheet DOWN to the last record on each sheet.

That should then be my template done and dusted and another 5 minutes saved daily. Thanks for the help.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Don't just leave out the titles, remove those columns!
 
Upvote 0

Forum statistics

Threads
1,216,027
Messages
6,128,373
Members
449,445
Latest member
JJFabEngineering

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