View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Deleting rows in two columns with a code in visual basic


A re-read suggests that you either need to have a unique list or use a macro
to create a unique list.
Then a for each loop for each item in the list to look for duplicates that
start with w. Doable

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
try thisselect the title row(row1) datafilterautofiltercustombegins
with w

abbbbb
ddd
wass
ddd
wass
ddd
wass
ddd
wass
ddd
wass
ddd
wass
ddd
wass


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ruben" wrote in message
...
Hello,

I have a problem with making a code in visual basic. I would like to make
a
code that deletes all rows in which the value of column G starts with a
€˜W
(after €˜W there is a number, example: W-123-231). I can do this, but now
comes the most difficult thing.
All my rows have numbers in column C, varying from 100 till 1000 (my
total
file is about 5000 rows). Some rows have the same number in column C
(because
they are related to each other: same kind of product). Because I would
like
to delete all rows for which the first value in column G is a €˜W, I also
would like to delete all rows that are related to the rows with a €˜W in
column G. So for the row which value in column G starts with a €˜W, all
related rows should be deleted as well. This means that all rows with the
same number in column C as the row with a €˜W in the G column, have to be
deleted.
So, in summary, all rows that start with a `Wยด in column G and the
related
rows (which have the same number in column C) have to be deleted.
I dont know how I can put this in a code in visual basic, so it would be
great if someone could tell me! I hope my problem is clear, if it is not
let
me know. Thank you very much for helping me!