Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hyperion Essbase Excel Add-in - returning text ("0") for null valu | Excel Discussion (Misc queries) | |||
Hyperlink "friendly-name" won't preserve links in PDF publishing | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
supress/answer "name ... already defined" msg when overwriting w/m | Excel Programming | |||
Users overwriting cells with Validation set to "Lists" | Excel Discussion (Misc queries) |