![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
How can I make my sorting macro ignore the hidden formulas?
My macro sorts fine and includes everything I want but I have extra cells for adding new data that contain a formula. When my macro sorts it places all empty cells at the top of the list then the data. When I delete the hidden formulas the sort places the empty cells at the bottom of my list like I want. Is there any way to code my macro to treat all cells that contain only the formula(not the data) as empty? The only thing the formula is, is a reference to another sheet ie. ='Sheet6'!$A$6. Thanks,
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Viper
Push F5 and use the Edit>Go to Special - Formulas to select your formula cells, then hide the rows. Excel will not sort hiiden rows. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
test
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Dave,
Thanks, but I do want them included in my sort. They are part of a group. So can I go at it differently? Can I change my code to sort only those in Range("A6:C10,A12:C40") <> "", or will the sort still pick up the hidden formula?
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Louisville, KY
Posts: 72
|
add a space like this:
=" "&'Sheet6'!$A$6 and the formula cells should drop to the bottom of the list |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
You the man!! Worked great. Is there anyway to prevent the empty cell from showing #value? I tried =IF(ISERROR(""&'Team Entry'!A5),"",""&'Team Entry'!A5) in each cell but that seemed to cancel out the space and put the empty cells on top again after sorting.
But thanks for the information.
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#7 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
(ISERROR(""&'Team Entry'!A5),"",""&'Team Entry'!A5) has no spaces in it. Try:
(ISERROR(" "&'Team Entry'!A5)," "," "&'Team Entry'!A5) |
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
|
Thanks Nate,
Still puts empty at top. I even did =" " & if(iserror(" " & 'sheet'!$A$5)," "," " & 'sheet'!$A$5) but still no effect. But thanks for all your help. I'll work on it somemore, I've got until 4/2/02 before I roll it out.
__________________
I appreciate the help from everyone at Mr. Excel. viper |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Apr 2002
Location: Decatur IL, USA
Posts: 494
|
I have the same conundrum. In cells in Column D, I have the following formula:
=IF(ISERROR(VLOOKUP(C4,$B$43:$D$73,3,FALSE)),"",VLOOKUP(C4,$B$43:$D$73,3,FALSE)) It works fine but when I sort the column, all the blanks sort to the top. So, I modified it to: =IF(ISERROR(VLOOKUP(C4,$B$43:$D$73,3,FALSE))," "&VLOOKUP(C4,$B$43:$D$73,3,FALSE),VLOOKUP(C4,$B$43:$D$73,3,FALSE)) based on the above suggestions. I now get #N/A as a result when there is no value to pull in, which isn't a problem except that I don't want it to show as such. I went to the Page Layout tab, Page Setup, Sheets and asked that errors display as Does anyone have another other suggestions?
__________________
Thanks, Shirlene |
|
|
|
|
|
#10 |
|
MrExcel MVP
Moderator Join Date: Mar 2007
Location: Cleveland OH
Posts: 10,936
|
Perhaps your CF Criteria needs to be " #N/A" rather than "#N/A" - if we are prefixing a space to the result.
Another idea (a bad one maybe) would be to use "ZZZ" as the value for "not found" results - so it drops to the bottom of a text-sorted list. You might then use a CF to conditionally format ZZZ as White to "blend in" with the background.
__________________
Using: Office 2007/XP SP3 (work), Excel 2010/XP SP3 (home) One is not born into the world to do everything but to do something. -- Henry David Thoreau |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|