Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Clear contents of cells if a condition is met

I am trying to come up with a formula that will clear the contents in a range
of cells if another cell contains an X on the same row. Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Clear contents of cells if a condition is met

Hi,

You cant have a formula in (say) A1 along the lines of

=if(b1="x",c1="")

you could do this in A1

=IF(B1="x","","No x")

which leaves A1 blank if there's an X in B1 otherwise you need a macro

Mike

"bevchapman" wrote:

I am trying to come up with a formula that will clear the contents in a range
of cells if another cell contains an X on the same row. Any suggestions?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Clear contents of cells if a condition is met

Formulas can return values to the cells in which they are written.

They cannot clear contents of another cell.

Are you ready for VBA?

Sub Clear_Stuff()
Dim rng As Range
With Selection
For Each rng In Selection
If rng.Value = "x" Then
rng.EntireRow.ClearContents
End If
Next rng
End With
End Sub


Gord Dibben MS Excel MVP

On Mon, 16 Mar 2009 07:51:01 -0700, bevchapman
wrote:

I am trying to come up with a formula that will clear the contents in a range
of cells if another cell contains an X on the same row. Any suggestions?


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
Clear Contents Secret Squirrel Excel Discussion (Misc queries) 1 February 3rd 09 12:37 AM
Macro clear cells if meet 1 condition Sojo Excel Worksheet Functions 8 October 20th 08 02:38 PM
Clear Contents Of Cells Where Value = 0 carl Excel Worksheet Functions 3 July 6th 07 06:02 PM
Macro to clear contents of unprotected cells AND drop down boxes JB2010 Excel Discussion (Misc queries) 3 March 30th 06 10:13 AM
Clear Contents - NonBold cells Steve Excel Discussion (Misc queries) 3 February 13th 05 11:36 PM


All times are GMT +1. The time now is 11:52 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"