VBA Macro to Move complete Row to New Sheet in a table/Auto updating priority list in a table when new data entered

VBA_Whiplash

New Member
Joined
Jan 8, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have tried multiple codes of other threads to get this action to work. I am wanting two things if possible, the first is to move a row based on condition (Complete) in my CDM Builds sheet to another sheet named Completed Builds automatically as the conditions are selected/changed.

The other thing I am looking to do is auto update the CDM Builds sheet when the in order of stat, high, medium, low - appearing in that order, so when a new entry is input with that condition it will auto update into its correct grouping and alphabetize (A-Z) within that grouping based on trade name.

Appreciate the help

PS: There is a bit of conditional formatting in this sheet/data validation. I kept getting an error when trying to use L2BB to post the range of data.

Excel Capture.PNG
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You can try this

VBA Code:
Sub copydata()

Dim count_col, count_row As Integer
Dim build, completed As Worksheet

Set build = ThisWorkbook.Sheets("CDM Build")
Set completed = ThisWorkbook.Sheets("Completed Buids")

count_col = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlToRight)))
count_row = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))

build.Activate

ActiveSheet.Range("A1").AutoFilter field:=1, Criteria1:="Complete"

build.Range(Cells(1, 1), Cells(count_row, count_col)).Offset(1).SpecialCells(xlCellTypeVisible).Copy  'copies only visible cells
completed.Range("A1").End(xlDown).Offset(1).PasteSpecial xlPasteValues 'finds next empty cell and paste

Application.CutCopyMode = xlCopy

Range("A1").CurrentRegion.Offset(1).EntireRow.Delete

Range("A1").Select
build.ShowAllData

Range("A1").CurrentRegion.Sort key1:=Range("A1"), order1:=xlDescending, Header:=xlYes  'sorts

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,830
Members
449,190
Latest member
rscraig11

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