Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default "Flase" overwriting value in cell...want to preserve existing valu

Hi all:

I have a formula that checks column A for a "Yes" or "No".
If "Yes" I want to leave the value (whole number) in Column B intact (this
is where I'm having a problem).
If column A has a "No" I want to blank out the value in column B.

I place the following formula in cell B1 and drag down to apply to all of
the B column: =IF(A1="No"," ")

The problem is if column A has a "Yes" it does not retain the value in
column B, rather it overwrites it with "False".

How can I prevent this from happening?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default "Flase" overwriting value in cell...want to preserve existing valu

Sub rick001()
For Each r In Intersect(ActiveSheet.UsedRange, Range("A:A"))
If r.Value = "No" Then
r.Offset(0, 1).Clear
End If
Next
End Sub

--
Gary''s Student - gsnu200909
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default "False" overwriting value in cell...want to preserve existing



Thanks for the quick reply! Could you assist on how I can apply this to my
spreadsheet. Sorry, I'm a bit of a lightweight with Excel.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Flase" overwriting value in cell...want to preserve existing valu


Rick;570712 Wrote:
Hi all:

I have a formula that checks column A for a "Yes" or "No".
If "Yes" I want to leave the value (whole number) in Column B intact
(this
is where I'm having a problem).
If column A has a "No" I want to blank out the value in column B.

I place the following formula in cell B1 and drag down to apply to all
of
the B column: =IF(A1="No"," ")

The problem is if column A has a "Yes" it does not retain the value in
column B, rather it overwrites it with "False".

How can I prevent this from happening?

Thanks!


A cell can contain a formula OR a bare value. Not both.
2 solutions:
1.Add a 'helper' column to the right of column B and in the new column
in cell C1 enter:
=if(A1="No","",B1)
and copy down as far as necessary.
You should now have a column that looks right. Now it's a case of
copying that column C data back into column B using Copy with
PasteSpecial|Values. Now you can delete that helper column.
2. Use a macro. You posted this in the programming section so run this
macro after selecting the cells you want processed in column B:
Sub blah()
For Each cll In Selection.Cells
If cll.Offset(, -1) = "No" Then cll.Value = Empty
Next cll
End Sub


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157668

Microsoft Office Help

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default "False" overwriting value in cell...want to preserve existing


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200909


"Rick" wrote:



Thanks for the quick reply! Could you assist on how I can apply this to my
spreadsheet. Sorry, I'm a bit of a lightweight with Excel.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default "False" overwriting value in cell...want to preserve existing


gsnu200909 and P45cal Thanks for the help!

I accomplished via the helper column. I wasn't aware that the formula was
conflicting with the hard code value.

I'm now going to take a bit of time to get acquainted with Macros.

Thanks again for the direction.
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
Hyperion Essbase Excel Add-in - returning text ("0") for null valu bill_morgan Excel Discussion (Misc queries) 7 February 28th 12 05:10 AM
Hyperlink "friendly-name" won't preserve links in PDF publishing ExcelUser Excel Worksheet Functions 0 February 2nd 09 10:50 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
supress/answer "name ... already defined" msg when overwriting w/m owp^3 Excel Programming 2 April 25th 08 06:01 PM
Users overwriting cells with Validation set to "Lists" Mack Neff[_2_] Excel Discussion (Misc queries) 3 June 25th 07 05:39 PM


All times are GMT +1. The time now is 01:57 AM.

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"