Moving data down or up to row 10

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,201
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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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
 
Upvote 0
Solution

Forum statistics

Threads
1,215,790
Messages
6,126,926
Members
449,349
Latest member
Omer Lutfu Neziroglu

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