Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pat Pat is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tom Ogilvy - Delete Non-Selected Rows SparePersn Excel Programming 1 December 21st 04 04:26 PM
Delete non-selected rows SparePersn Excel Programming 2 December 21st 04 02:57 PM
Delete Selected Rows Ken[_18_] Excel Programming 2 February 5th 04 10:33 PM
Need a macro to delete selected rows RKettle Excel Programming 5 January 13th 04 05:29 PM
Delete/Collapse Rows Not Selected Cindy Excel Programming 19 November 21st 03 03:38 AM


All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"