![]() |
Delete selected rows data
I need to run a macro that will delete data in certain rows and in certain
cells. If a cell in AJ contains the word "delete row data" then data in that row cells (including AJ) B, D:F, I:L, N:X should be deleted. For example if AJ121 = "delete row data" then delete AJ121, B121, D121:F121, I121:L121, N121:X121 also if AJ203= "delete row data" then delete AJ203, B203, D203:F203, I203:L203, N203:X203 also if AJ246= "delete row data" then delete AJ246, B246, D246:F246, I246:L246, N246:X246 Hope I have explained properly what I am wishing to accomplish. Thanks if you can be of help. Pat |
Delete selected rows data
lastrow = cells(rows.count,"AJ").End(xlup).row
for i = lastrow to 1 step -1 if cells(i,"AJ").Value = "delete row data" then cells(i,1).Range("B1,D1:F1,I1:L1,N1:X1,AJ1").Clear Contents end if Next -- Regards, Tom Ogilvy "Pat" wrote in message ... I need to run a macro that will delete data in certain rows and in certain cells. If a cell in AJ contains the word "delete row data" then data in that row cells (including AJ) B, D:F, I:L, N:X should be deleted. For example if AJ121 = "delete row data" then delete AJ121, B121, D121:F121, I121:L121, N121:X121 also if AJ203= "delete row data" then delete AJ203, B203, D203:F203, I203:L203, N203:X203 also if AJ246= "delete row data" then delete AJ246, B246, D246:F246, I246:L246, N246:X246 Hope I have explained properly what I am wishing to accomplish. Thanks if you can be of help. Pat |
All times are GMT +1. The time now is 08:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com