Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Tom Ogilvy - Delete Non-Selected Rows | Excel Programming | |||
Delete non-selected rows | Excel Programming | |||
Delete Selected Rows | Excel Programming | |||
Need a macro to delete selected rows | Excel Programming | |||
Delete/Collapse Rows Not Selected | Excel Programming |