ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro is giving me problems with sorting (https://www.excelbanter.com/excel-programming/275908-macro-giving-me-problems-sorting.html)

Tom Ogilvy

Macro is giving me problems with sorting
 
In the sort command, for the header argument,
do you have

header:=xlguess

in your macro.

Change it to

header:=xlno

This assumes you don't have headers.

--
Regards,
Tom Ogilvy



"Charlene Dallos" wrote in message
...
I am currently creating a database for my company and when I record my
macros and create my VB code and implement them into my command buttons,

It
will sort everything except my top row.

There are nine columns in my database, it's about 100 rows long and my

first
two columns will sort just fine, but when I click on my third, forth,

fifth
etc. all the rows will sort except the very first one.

I messed around with it for hours and I know it's probably something very
easily fixable. Please Help!





Myrna Larson[_2_]

Macro is giving me problems with sorting
 
Excel probably is "thinking" the first row is a header. Your code should include the argument to
explicitly "tell" Excel whether there are headers or not. Check Help for more information.

On Tue, 2 Sep 2003 14:23:06 -0400, "Charlene Dallos" wrote:

I am currently creating a database for my company and when I record my
macros and create my VB code and implement them into my command buttons, It
will sort everything except my top row.

There are nine columns in my database, it's about 100 rows long and my first
two columns will sort just fine, but when I click on my third, forth, fifth
etc. all the rows will sort except the very first one.

I messed around with it for hours and I know it's probably something very
easily fixable. Please Help!



Mark Bigelow

Macro is giving me problems with sorting
 
Make sure you have the following Header part in your sort code:

Range("A:A").Sort Key1:=Range("A1"), Header:=xlNo

This tells Excel that the first line is not a header and to go ahead and
sort it.

Let me know if that doesn't work.

Mark

---
Mark Bigelow
mjbigelow at hotmail dot com
http://hm.imperialoiltx.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Charlene Dallos

Macro is giving me problems with sorting
 
I am currently creating a database for my company and when I record my
macros and create my VB code and implement them into my command buttons, It
will sort everything except my top row.

There are nine columns in my database, it's about 100 rows long and my first
two columns will sort just fine, but when I click on my third, forth, fifth
etc. all the rows will sort except the very first one.

I messed around with it for hours and I know it's probably something very
easily fixable. Please Help!




All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com