Finding 2 rows, cut and paste to top of sheet

ganners9

New Member
Joined
Jul 3, 2017
Messages
1
Hi,

This is my current code that is working

Sub SortSCRA()
Sheets("C&P Output").Select
Columns("a:bku").Select
Selection.Sort Key1:=Range("aye3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Application.Goto Sheet3.Range("a1"), True
Sheet4.Range("Aye3:Aye12").Copy
Sheet3.Range("b34:b43").PasteSpecial xlPasteValues
Sheet4.Range("g3:g12").Copy
Sheet3.Range("c34:c43").PasteSpecial xlPasteValues
End Sub


But after sorting the data, 2 rows are being sorted in the middle of the sheet.
I want to find these 2 rows - in column A one contains "year" and one contains '"A1"
Then cut and paste them to the top of the sheet.

I've tried several times but can't get this to work.
Help appreciated.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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