PLLLLEASEEEE HELP FOR MACRO

catch22

New Member
Joined
Nov 4, 2002
Messages
37
i've got 1 worksheet with 30 rows and 20 columns. Now what i want is a macro that will:
cut column B and paste it in Column A under A30. After that it should cut column C and paste it under Column A (ie now A60).This process should go on till all the columns are cut and pasted in column A.

I require this so that I can then work on the data better in 1 column. After that, I would require another macro to reverse what I have done, but with the data that I have worked upon. ie, get the modified data back into the 20 columns.

I hope i've not confused you. i've trid my best to explain the requirement. Could anyone pls help me? it's urgent.

thanks a ton in advance
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
In this instance in row 31 I have entered the column letter eg B31 = B C31 = C etc - you could use cells so as to not to need this but this is how I am used to coding...

By pasting values you're not removing the data from it's original point so you don't need to reverse the macro.

Sub TEST()

DATA = Range("B31:U31")
CROW = 30

For Each LDATA In DATA

If LDATA = "" Then Exit For

Range(LDATA & "1:" & LDATA & "30").Copy
Range("A" & CROW).PasteSpecial xlPasteValues

CROW = CROW + 30

Next LDATA

End Sub


_________________
LASW10
This message was edited by lasw10 on 2002-11-07 05:24
 

catch22

New Member
Joined
Nov 4, 2002
Messages
37
sweety luke,

your macro has worked very well for the 1st part ie. pasting the data in 1 column. however, after i have worked on the data, i am not able to get the worked upon data back into the original columns. is that part to be done manually? (ie cut & paste) pls revert
 

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123

ADVERTISEMENT

you should find that this method doesn't move the original data (it copies and pastes not cut and paste) - so I didn't think you would need to put it back...

i.e. if you copy B1:B30 to A30 - the data will appear in A30:A59 but it will still be in B1:B30...
 

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
Sorry - just got what you were getting at...this will put the amended data back into columns B - U



Sub REVERT()

DATA = Range("B31:U31")
CROW = 30

For Each LDATA In DATA

If LDATA = "" Then Exit For

Range("A" & CROW & ":" & "A" & CROW + 29).Copy
Range(LDATA & "1").PasteSpecial xlPasteValues

CROW = CROW + 30

Next LDATA

End Sub
 

catch22

New Member
Joined
Nov 4, 2002
Messages
37
smoooch smoooch smooch..what more can i say!! ( & do!!);)...why do i always come along late? why are the good ones always taken? i guess, this is my fate :(
 

Forum statistics

Threads
1,144,290
Messages
5,723,522
Members
422,502
Latest member
barakgahtan

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
Top