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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Don't just leave out the titles, remove those columns!
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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