Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Sheet 2 has the values A B 1 CAR BUS 2 3 Sheet 1 Has A B 1 BUS 2 TRAIN 3 CAR 4 BIKE 5 BUS I want to programatically select as a range CAR BUS (sheet 2) and delete other entire rows in sheet 2 i.e A B 1 BUS 2 CAR 3 BUS Thanks for all future help -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200911/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim source as range
dim basedata as string set source = worksheets("sheet2").Range("A1") do until source = "" basedata = basedata & "," & source.Value set source = sourcde.Offset( ,1) loop set source = worksheets("sheet1").Range("B1").End(xlDown) do if Instr(basedata,source) =0 then worksheets("sheet1").Rows(source.row).Delete end if if source.row=1 then exit do set source = source.offset(-1) loop ' basedata will be a concatenated string of your sheet2 row..."CAR,BUS" the second loop reads each item and checks if its in the list, eg instr("CAR,BUS","BUS") will = 5 while instr("CAR,BUS","DOG") will be zero, and that row deleted "FIRSTROUNDKO via OfficeKB.com" <u15639@uwe wrote in message news:9fb26cce03583@uwe... Hi, Sheet 2 has the values A B 1 CAR BUS 2 3 Sheet 1 Has A B 1 BUS 2 TRAIN 3 CAR 4 BIKE 5 BUS I want to programatically select as a range CAR BUS (sheet 2) and delete other entire rows in sheet 2 i.e A B 1 BUS 2 CAR 3 BUS Thanks for all future help -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200911/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete values in sheet 2 that arre found in sheet 1 | Excel Discussion (Misc queries) | |||
Hide rows of one sheet based on values in another sheet? | Excel Programming | |||
Delete rows from one sheet containing deatils on the second sheet | New Users to Excel | |||
Delete rows at end of sheet | Excel Discussion (Misc queries) | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions |