Question

viper

Active Member
Joined
Feb 15, 2002
Messages
382
Can a hidden formula effect the sorting process? I have a worksheet that I have written code to sort at a certain time. On the one page the sort works fine, but on another page that has several cells with hidden formulas the sort works differently. What I mean is, I sort from A6:C10 and A12:c40, on each page there are 6 cells at the bottom of my list that are blank, this is fine for the first page the sort sorts from cell A12 down leaving the blank ones at the bottom, but on the other page the 6 empty cells contain a hidden formula and when sorted the empty cells are moved to the top. Can I change this code to ignore the hidden formulas so that the empty cells are at the bottom on both pages?

Code:
Application.ScreenUpdating = False
Range("A6:C10").Select
Selection.Sort Key1:=Range("A6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A13:C40").Select
Selection.Sort Key1:=Range("A13"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi
I may be missing the point but why not change C40 to C34? Why include the last 6 rows in the sort if you don't want them sorted?
regards
Derek
 
Upvote 0
I do need them to remain at the bottom of the list. I have them there because on the page the sorting works correctly is where data is stored and I need to allow for new entries into those cells. The hidden formula is just an ='sheet 3'!A35 formula so when an entry is made on Sheet 3 A35 it is automattically transferred to the other sheets. It is not really a problem because the sorting still retained all the formulas and everything still does what it should, but it is driving me crazy trying to figure out why on one page I have my empty cells at the bottom of my list and on the other pages the empty cells are at the top of my list and I basically use the same sort cord for all sheets.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,172
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top