Automatically update a file when a cell is changed

OJSMALL

New Member
Joined
Sep 17, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm new to all this, I have a spreadsheet where i have to do checks and i was looking to have the item moved to the bottom of the file when completed, I would like this to happen automatically when i update rather than having to run the code again and again,
The cells are G2 - G100 but i cant make it automatically happen ! Can this be done ??
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Welcome to the Board!

You can have this run automatically upon a specific cell being updated, as long as it is being updated manually and not by a formula.
So, are you saying that when the value in column G is updated, that whole row should move down to the bottom of the list?
 
Last edited:
Upvote 0
The following code will move a row to the bottom of the sheet when column G is manually updated.

To make sure it runs automatically, you must put it in the proper module. An easy way to ensure this is to go to the sheet you want to apply it to, right-click on the Sheet tab name at the bottom of the screen, select "View Code", and paste this VBA code in the VB Editor that pops up:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim r As Long

'   Only run if one cell updated at a time
    If Target.CountLarge > 1 Then Exit Sub
    
'   Only run if cell updated is in column G after row 1
    If Target.Row = 1 Or Target.Column <> 7 Then Exit Sub
    
    Application.EnableEvents = False
    
'   Get row number of update
    r = Target.Row
'   Move row to bottom of sheet
    Rows(r).Cut Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
'   Delete blank row
    Rows(r).Delete
    
    Application.EnableEvents = True
    
End Sub
Then, as long as you have VBA/Macros enabled, this code will run automatically when column G is manually updated.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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