Copying/Reformatting records

MC09

New Member
Joined
Jun 11, 2008
Messages
6
Hi,

Please help

I have worksheets that contains couple of records that I need to copy in another worksheet.

Example:
A --- B
1 AA1 ---01.01.2008
2 AA2 ---01.01.2008
3 AA3 ---01.01.2008
4 AA4 ---01.01.2008
5
6
7 BB1 ---01.03.2008
8 BB2 ---01.04.2008

RESULT:
1 TITLE ---DATE --- header
2 AA1 ---01.01.2008
3 AA2 ---01.01.2008
4 AA3 ---01.01.2008
5 AA4 ---01.01.2008
6
7
8 TITLE ---DATE --- another table/header
9 BB1 ---01.03.2008
10 BB2 ---01.04.2008

Thanks in advance
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I hope I have understood what you want.


try this macro "test"
the macro "undo" undoes what you have done.
give feedback

Code:
Sub test()
Dim rng As Range
With Worksheets("sheet1")
Set rng = .Range("a1")
rng.End(xlDown).End(xlDown).CurrentRegion.Copy
    With Worksheets("sheet2")
    .Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).PasteSpecial
    .Range("a1") = "title"
    .Range("b1") = Date
    .Range("c1") = "header"
    .Range("a1").Select
    End With 'sheet2
 End With 'sheet1
 Application.CutCopyMode = False
End Sub
Code:
Sub undo() ' this removed the entreis made in sheet2
With Worksheets("sheet2")
.Cells.Clear
.Range("a1").Select
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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