ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Automate deletion process (https://www.excelbanter.com/excel-worksheet-functions/146363-automate-deletion-process.html)

JanM

Automate deletion process
 
How do I write a function or macro that will look at what is in a cell,
validate it, if correct delete the row, and if invalid just move down a row
and continue until the end of data in a column?
--
Jan M

Billy Liddel

Automate deletion process
 
The following macro looks for duplicates accross cols a, b, and c then
deletes the duplicate rows. It will give you an idea to to work on.

Regards
Peter

"JanM" wrote:

How do I write a function or macro that will look at what is in a cell,
validate it, if correct delete the row, and if invalid just move down a row
and continue until the end of data in a column?
--
Jan M


JanM

Automate deletion process
 
I'm sorry, but I don't see the macro.

Thanks,
Jan
--
Jan M


"Billy Liddel" wrote:

The following macro looks for duplicates accross cols a, b, and c then
deletes the duplicate rows. It will give you an idea to to work on.

Regards
Peter

"JanM" wrote:

How do I write a function or macro that will look at what is in a cell,
validate it, if correct delete the row, and if invalid just move down a row
and continue until the end of data in a column?
--
Jan M


Billy Liddel

Automate deletion process
 
Oops - sorry Jan

Sub DelDupes()
Dim i As Long, nr As Long, col As Integer, nc As Integer
Dim c, d As String, tmp
Range("A1").Select
nr = Range("A1").CurrentRegion.Rows.count
nc = Range("A1").CurrentRegion.Columns.count
'copy data to top row of each person
For i = nr To 2 Step -1
tmp = i
c = Cells(i, 1) & Cells(i, 2) & Cells(i, 3)
d = Cells(i - 1, 1) & Cells(i - 1, 2) & Cells(i - 1, 3)
If c = d Then
Range(Cells(i, 1), Cells(i, nc)).Delete
End If
Next i
End Sub

Regards
Peter

"JanM" wrote:

I'm sorry, but I don't see the macro.

Thanks,
Jan
--
Jan M


"Billy Liddel" wrote:

The following macro looks for duplicates accross cols a, b, and c then
deletes the duplicate rows. It will give you an idea to to work on.

Regards
Peter

"JanM" wrote:

How do I write a function or macro that will look at what is in a cell,
validate it, if correct delete the row, and if invalid just move down a row
and continue until the end of data in a column?
--
Jan M


Gord Dibben

Automate deletion process
 
Jan

Sub Delete_Valid_Rows()
findstring = "valid" 'substitute your validation parameter here
Set B = Range("A:A").Find(What:=findstring, LookAt:=xlWhole)
While Not (B Is Nothing)
B.EntireRow.Delete
Set B = Range("A:A").Find(What:=findstring, LookAt:=xlWhole)
Wend
End Sub


Gord Dibben MS Excel MVP

On Wed, 13 Jun 2007 09:00:03 -0700, JanM wrote:

How do I write a function or macro that will look at what is in a cell,
validate it, if correct delete the row, and if invalid just move down a row
and continue until the end of data in a column?




All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com