Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Values in a Row based on a Certain Criteria
Hello,
I am trying to import a worksheet that I copy and paste into a model. I need to erase the values in a specific row, in columns B thru G if the first 5 characters in column B contains the word "Total". I also need to erase the values in a specific row, in columns B thru G if column C contains "-----------". I have macro that deletes the rows if a certain criteria is met, however, deleting rows messes up my formulas on another sheet. Any suggestions would be greatly appreciated. Thank you in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Values in a Row based on a Certain Criteria
lastrow = Cells(rows.count,2).end(xlup).row
for i = lastrow to 2 step -1 if Instr(1,Trim(cells(i,2)),"total",vbTextCompare) = 1 or _ instr(1,cells(i,3),"-----",vbTextcompare) then cells(i,2).Resize(1,6).ClearContents end if Next i -- Regards, Tom Ogilvy "cardan" wrote: Hello, I am trying to import a worksheet that I copy and paste into a model. I need to erase the values in a specific row, in columns B thru G if the first 5 characters in column B contains the word "Total". I also need to erase the values in a specific row, in columns B thru G if column C contains "-----------". I have macro that deletes the rows if a certain criteria is met, however, deleting rows messes up my formulas on another sheet. Any suggestions would be greatly appreciated. Thank you in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting Values in a Row based on a Certain Criteria
On Sep 28, 11:12 am, Tom Ogilvy
wrote: lastrow = Cells(rows.count,2).end(xlup).row for i = lastrow to 2 step -1 if Instr(1,Trim(cells(i,2)),"total",vbTextCompare) = 1 or _ instr(1,cells(i,3),"-----",vbTextcompare) then cells(i,2).Resize(1,6).ClearContents end if Next i -- Regards, Tom Ogilvy "cardan" wrote: Hello, I am trying to import a worksheet that I copy and paste into a model. I need to erase the values in a specific row, in columns B thru G if the first 5 characters in column B contains the word "Total". I also need to erase the values in a specific row, in columns B thru G if column C contains "-----------". I have macro that deletes the rows if a certain criteria is met, however, deleting rows messes up my formulas on another sheet. Any suggestions would be greatly appreciated. Thank you in advance.- Hide quoted text - - Show quoted text - Works Great! Thank You! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting Rows based on multiple criteria | Excel Programming | |||
Deleting entire rows based on certain criteria | Excel Programming | |||
Deleting rows based on multiple criteria | Excel Programming | |||
Deleting rows based on cell criteria | Excel Programming | |||
Deleting rows based on criteria | Excel Programming |