Moving data down or up to row 10

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,744
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
I have the need for a macro that will goto to the active sheet,
look down column A
Find the cell that contains the word "Time" (this is the entire contents)
then move everything up or down so "Time" is in column A

So a few rule that might help,
Column A will Always Have the last row of data,
The data is in column A:DZ
only one cell in Column A will hold the Word "Time"
Moving the data is only everything from the "Time" row down, Time should be the very first row and can be any row in the sheet

thanks

Tony
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,977
Office Version
  1. 365
Platform
  1. Windows
Test on a COPY of your data
- your explanation is not complete

is this what you want

VBA Code:
Sub MoveData()
    Dim FoundRow As Long, MoveToRow As Long: MoveToRow = 10
   
    On Error GoTo TheEnd
        FoundRow = Range("A:A").Find("Time", LookIn:=xlValues, lookat:=xlWhole).Row
    On Error GoTo 0

    If MoveToRow > FoundRow Then MoveToRow = MoveToRow + 1
    If MoveToRow <> FoundRow Then
        Rows(FoundRow).Cut
        Rows(MoveToRow).Select
        Selection.Insert Shift:=xlDown
        Range("A" & MoveToRow).Select
    End If

Exit Sub
TheEnd:
    MsgBox "Not found", vbExclamation, "oops"
End Sub
 
Solution

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
2,744
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Thanks yondle,
this look perfect thank you, :)
Tony
 

Watch MrExcel Video

Forum statistics

Threads
1,129,810
Messages
5,638,484
Members
417,027
Latest member
wlknspc7

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