ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete next cell (https://www.excelbanter.com/excel-programming/374148-delete-next-cell.html)

delmac

delete next cell
 
Hi all, I've 2 columns:about 500 rows long. I dont need the rows where column
A contains a number ending in D such as 123-D. can anyone suggest a quick way
of deleting theses. I have over 10 sheets with hundreds of items . Thanks
agin.
A B
100-C Description
123-D Description
130-D Description
500-T Description
--
delmac

Don Guillett

delete next cell
 
try something like this

for each ws in worksheets
with ws
for i=.cells(.rows.count,1).end(xlup).row
if ucase(right(.cells(i,1),1))="D" then .rows(i).delete
end with
next ws
next i

--
Don Guillett
SalesAid Software

"delmac" wrote in message
...
Hi all, I've 2 columns:about 500 rows long. I dont need the rows where
column
A contains a number ending in D such as 123-D. can anyone suggest a quick
way
of deleting theses. I have over 10 sheets with hundreds of items . Thanks
agin.
A B
100-C Description
123-D Description
130-D Description
500-T Description
--
delmac




PCLIVE

delete next cell
 
This will clear the contents of the entire row if the value in A of the
current row ends with "D". Once completed, you would then need to sort
your data to remove the empty rows.

Sub test()
For Each cell In Range("A1:A" & Range("A65536").End(xlUp).Row)
If Right(cell, 1) = "D" Then cell.EntireRow.ClearContents
Next cell

End Sub


HTH,
Paul

"delmac" wrote in message
...
Hi all, I've 2 columns:about 500 rows long. I dont need the rows where
column
A contains a number ending in D such as 123-D. can anyone suggest a quick
way
of deleting theses. I have over 10 sheets with hundreds of items . Thanks
agin.
A B
100-C Description
123-D Description
130-D Description
500-T Description
--
delmac




Don Guillett

delete next cell
 
forgot to do a next
if ucase(right(.cells(i,1),1))="D" then .rows(i).delete
next i 'add
end with


--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try something like this

for each ws in worksheets
with ws
for i=.cells(.rows.count,1).end(xlup).row
if ucase(right(.cells(i,1),1))="D" then .rows(i).delete
end with
next ws
next i

--
Don Guillett
SalesAid Software

"delmac" wrote in message
...
Hi all, I've 2 columns:about 500 rows long. I dont need the rows where
column
A contains a number ending in D such as 123-D. can anyone suggest a quick
way
of deleting theses. I have over 10 sheets with hundreds of items . Thanks
agin.
A B
100-C Description
123-D Description
130-D Description
500-T Description
--
delmac







All times are GMT +1. The time now is 08:14 AM.

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