LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Contents of multiple continuous ranges

Hi all,
I am trying to clear the content of certain cells in my worksheet only if
certain criteria is met. For Example,
If C5=Delete I want the following range cleared (G3:H3,K3:L3, H5:K7,M5:O7
If C12=Delete I want the following range
cleared(G10:H10,K10:M10,H12:K14,M12:O14)
and so on

Dont know if this will help but,
there is some relationship of 6 cells in between one range and the other
(from C5 to C12 there're 6 cells (that I want to remain untouch) from C12 and
C19 there are 6 cells and so on. The same with the range I want to be
cleared
From G3 to G10 there are 6 cells (that I want to reamin untouch)

This is what I have: but is not working (there's no changes on my worksheet)
-----------------------------------------
Dim x As Long
Dim lastrow As Long

Application.ScreenUpdating = False

lastrow = Range("A65536").End(xlUp).Row

For x = 5 To lastrow
If Cells(x, 3) = "Delete" Then
Range("G3:H3, K3:L3, H5:K7,M5:O7, G10:H10, K10:M10, H12:K12,
M12:O12").ClearContents
Application.ScreenUpdating = True
End If
Next x

End Sub



 
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
clear contents Arne Hegefors Excel Programming 1 June 13th 07 03:39 PM
Macro to clear range contents when cell contents are changed by us Steve E Excel Programming 12 February 22nd 07 09:09 PM
Clear contents Arne Hegefors Excel Programming 3 September 28th 06 05:43 PM
Clear contents SamanthaK Excel Programming 3 June 15th 06 09:05 AM
Clear Contents Help michael Excel Programming 3 June 6th 06 09:42 PM


All times are GMT +1. The time now is 06:00 PM.

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

About Us

"It's about Microsoft Excel"