ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete rows if data changes in particular column (https://www.excelbanter.com/excel-programming/406515-delete-rows-if-data-changes-particular-column.html)

jscorsone

Delete rows if data changes in particular column
 
Hi, I'm seeking assistance with a macro. I'm trying to delete subsequent
rows if data in a particular cell in Column B changes.

I need to create a macro because there are thousands of products and using
autofilter to sort and delete would take a while.

Any assistance would be greatly appreciate, thanks!

Don Guillett

Delete rows if data changes in particular column
 
More info

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Hi, I'm seeking assistance with a macro. I'm trying to delete subsequent
rows if data in a particular cell in Column B changes.

I need to create a macro because there are thousands of products and using
autofilter to sort and delete would take a while.

Any assistance would be greatly appreciate, thanks!



jscorsone

Delete rows if data changes in particular column
 
Sure, I didn't explain that very well.

I have 6 columns of data, thousands of rows of data.

Columns B, C, D, E, F will change. The column I'm concerned with is Column
B, Item Number. There are multiple rows of data with the same Item Number
(Column B.)

I'd like to delete all rows after the first row for a particular item name,
until Column B changes to a new number.


"Don Guillett" wrote:

More info

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Hi, I'm seeking assistance with a macro. I'm trying to delete subsequent
rows if data in a particular cell in Column B changes.

I need to create a macro because there are thousands of products and using
autofilter to sort and delete would take a while.

Any assistance would be greatly appreciate, thanks!




Don Guillett

Delete rows if data changes in particular column
 
for
1
1
1
2
2
3
this will leave
1
2
3
Sub deletedups()
mc = "b"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) = Cells(i, mc) Then Rows(i).Delete
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Sure, I didn't explain that very well.

I have 6 columns of data, thousands of rows of data.

Columns B, C, D, E, F will change. The column I'm concerned with is
Column
B, Item Number. There are multiple rows of data with the same Item Number
(Column B.)

I'd like to delete all rows after the first row for a particular item
name,
until Column B changes to a new number.


"Don Guillett" wrote:

More info

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Hi, I'm seeking assistance with a macro. I'm trying to delete
subsequent
rows if data in a particular cell in Column B changes.

I need to create a macro because there are thousands of products and
using
autofilter to sort and delete would take a while.

Any assistance would be greatly appreciate, thanks!





jscorsone

Delete rows if data changes in particular column
 
That's exactly what I needed. Thanks so much for your assistance!

"Don Guillett" wrote:

for
1
1
1
2
2
3
this will leave
1
2
3
Sub deletedups()
mc = "b"
For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1
If Cells(i - 1, mc) = Cells(i, mc) Then Rows(i).Delete
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Sure, I didn't explain that very well.

I have 6 columns of data, thousands of rows of data.

Columns B, C, D, E, F will change. The column I'm concerned with is
Column
B, Item Number. There are multiple rows of data with the same Item Number
(Column B.)

I'd like to delete all rows after the first row for a particular item
name,
until Column B changes to a new number.


"Don Guillett" wrote:

More info

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jscorsone" wrote in message
...
Hi, I'm seeking assistance with a macro. I'm trying to delete
subsequent
rows if data in a particular cell in Column B changes.

I need to create a macro because there are thousands of products and
using
autofilter to sort and delete would take a while.

Any assistance would be greatly appreciate, thanks!






All times are GMT +1. The time now is 06:13 AM.

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