P
Paul Simon
There have been a few solutions (mostly manual) posted for sorting a
database with blank cells in the chosen sort fields being sorted first
instead of last. I'm trying to come up with a more automated method
but am stumped on the first part of my method which involves a
UserForm.
Using Excel 2000, I'm trying to create a UserForm which as closely as
possible looks and acts like Excel's standard Sort dialog box and then
use that UserForm in place of the Sort dialog box whenever I want
blank cells sorted first instead of last.
Like the Sort dialog box, this UserForm would let you choose up to 3
fields and designate either Ascending or Descending for each and
perhaps even allow for indicating "Header Row" or "No Header Row".
(Duplicating all the options that come up when clicking the Options
button in the Sort dialog box would be "pushing the envelope" too
much, I'm sure.)
Code associated with this UserForm would do the following:
1. Trap whatever fields were chosen in that UserForm
2. Fill any blank cells within those fields with a very large (or
should I say very small) negative number (such as -9999999999) to
insure they get sorted first
3. Sort the database
4. Change the fields containing that -9999999999 number back to blank
again
5. Then lastly, unload the UserForm.
I'm kind of weak on this level of UserForm creation. Any help would
be greatly appreciated.
Many thanks,
Paul
database with blank cells in the chosen sort fields being sorted first
instead of last. I'm trying to come up with a more automated method
but am stumped on the first part of my method which involves a
UserForm.
Using Excel 2000, I'm trying to create a UserForm which as closely as
possible looks and acts like Excel's standard Sort dialog box and then
use that UserForm in place of the Sort dialog box whenever I want
blank cells sorted first instead of last.
Like the Sort dialog box, this UserForm would let you choose up to 3
fields and designate either Ascending or Descending for each and
perhaps even allow for indicating "Header Row" or "No Header Row".
(Duplicating all the options that come up when clicking the Options
button in the Sort dialog box would be "pushing the envelope" too
much, I'm sure.)
Code associated with this UserForm would do the following:
1. Trap whatever fields were chosen in that UserForm
2. Fill any blank cells within those fields with a very large (or
should I say very small) negative number (such as -9999999999) to
insure they get sorted first
3. Sort the database
4. Change the fields containing that -9999999999 number back to blank
again
5. Then lastly, unload the UserForm.
I'm kind of weak on this level of UserForm creation. Any help would
be greatly appreciated.
Many thanks,
Paul