#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Conditional delete

Hi,

A B C
D E F
G H I

are a block of cells. Cell C is the active cell (cursor position). If cell D
contains the word "Group N" where N can be a number from 1 to 4, I want to
delete the content of cells D, E, F, G, H and I. If not, to continue on with
the next line of code.
Any help is much appreciated.

TIA
Tom

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Conditional delete

select your C, F, I cells (or further down) and try:

Sub cus()

For Each cell In Selection
For i = 1 To 4
If cell.Offset(1, -2) = "Group " & i Then
Range(cell.Offset(1, -2), cell.Offset(2, 0)).ClearContents
Exit For
End If
Next i
Next cell

End Sub

pls click YES if it helped

On 15 Paź, 04:36, "tom" wrote:
Hi,

A Â* Â*B Â* Â*C
D Â* Â*E Â* Â*F
G Â* Â*H Â* Â*I

are a block of cells. Cell C is the active cell (cursor position). If cell D
contains the word "Group N" where N can be a number from 1 to 4, I want to
delete the content of cells D, E, F, G, H and I. If not, to continue on with
the next line of code.
Any help is much appreciated.

TIA
Tom


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Conditional delete

Those codes work perfectly. Thank you, Jarek.

Regards,
Tom

"Jarek Kujawa" wrote in message
...
select your C, F, I cells (or further down) and try:

Sub cus()

For Each cell In Selection
For i = 1 To 4
If cell.Offset(1, -2) = "Group " & i Then
Range(cell.Offset(1, -2), cell.Offset(2, 0)).ClearContents
Exit For
End If
Next i
Next cell

End Sub

pls click YES if it helped

On 15 Paź, 04:36, "tom" wrote:
Hi,

A B C
D E F
G H I

are a block of cells. Cell C is the active cell (cursor position). If cell
D
contains the word "Group N" where N can be a number from 1 to 4, I want to
delete the content of cells D, E, F, G, H and I. If not, to continue on
with
the next line of code.
Any help is much appreciated.

TIA
Tom


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
delete conditional formatting via macro mohavv Excel Discussion (Misc queries) 1 August 27th 08 11:57 PM
How can I use conditional formatting to hide or delete rows? linda.beautiful.california Excel Worksheet Functions 6 July 15th 08 09:09 PM
Conditional Delete [email protected] New Users to Excel 3 May 25th 07 03:25 AM
Macro code to delete conditional formatting Bovine Jones Excel Discussion (Misc queries) 5 October 19th 06 08:39 AM
Adding a loop to conditional delete code maw via OfficeKB.com New Users to Excel 21 August 15th 06 04:11 PM


All times are GMT +1. The time now is 09:20 PM.

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"