Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to sort for some pretty specific stuff and delete everything
else. Sort Column A for the letters Whse: ## and Column B for the letters Source: ### the ###'s vary but I want everything with those letters in it selected and EVERYTHING ELSE deleted. Make Sense? EX: If Column A has Whse: ## AND Column B has Source: ### Then Delete everything else. I know it's a mess and I'm getting nowhere. Any input would be GREATLY appreciated. THANKS!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
to not delete both columns A and B on that row must contain the strings
set lastrow = cells(rows.count,1).End(xlup).row for i = lastrow to 1 step -1 if instr(1,cells(i,1),"Whse: ", vbTextCompare) 0 and _ instr(1,cells(k,2),"Source: ", vbTextCompare) 0 then ' do nothing else if rng is nothing then set rng = cells(i,1) else set rng = union(rng,cells(i,1)) end if end if Next if not rng is nothing then rng.Entirerow.Delete End if or If either contains the specific string, then don't delete set lastrow = cells(rows.count,1).End(xlup).row for i = lastrow to 1 step -1 if instr(1,cells(i,1),"Whse: ", vbTextCompare) 0 or _ instr(1,cells(k,2),"Source: ", vbTextCompare) 0 then ' do nothing else if rng is nothing then set rng = cells(i,1) else set rng = union(rng,cells(i,1)) end if end if Next if not rng is nothing then rng.Entirerow.Delete End if -- Regards, Tom Ogilvy "bodhisatvaofboogie" wrote: I am trying to sort for some pretty specific stuff and delete everything else. Sort Column A for the letters Whse: ## and Column B for the letters Source: ### the ###'s vary but I want everything with those letters in it selected and EVERYTHING ELSE deleted. Make Sense? EX: If Column A has Whse: ## AND Column B has Source: ### Then Delete everything else. I know it's a mess and I'm getting nowhere. Any input would be GREATLY appreciated. THANKS!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting Values Without Sorting Formulas | Excel Discussion (Misc queries) | |||
Automatic sorting (giving max and min) based on custom sorting lis | Excel Worksheet Functions | |||
Sorting VLookup vs Sorting SumProduct | Excel Discussion (Misc queries) | |||
Sorting: Sorting by the First Character | Excel Discussion (Misc queries) | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |