Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default macro to sort is missing top row out???

Hi guys,
been running macros (activated by buttons) to sort spreadsheet from
specific collumns e.g.

ActiveSheet.Unprotect
Range("B10:GJ89").Select
Selection.Sort Key1:=Range("CO10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("CO1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True
ActiveWindow.ScrollColumn = 91
End Sub


Now, having edited this worksheet, when I run each macro: it misses out the
top row e.g. row #10 but sorts the rest??????
Checked the macro and it hasn`t changed and this is happening to all my
macros now on this sheet. Use the same macros on similar sheets in workbook
and they still work fine. Sorted the sheet `by hand` and it sorts just fine.
Any ideas : I`m stuck until I get it sorted an on a deadline HELP!
Thanks
RR1
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default macro to sort is missing top row out???

Change
Header:=xlGuess
to
Header:=xlNo

You're letting Excel figure out if your data has a heading row (apparently
it doesn't, or you wouldn't want row 10 sorted). xlNo tells Excel that the
dta does not include a heading row.

Hope this helps,

Hutch

"Romileyrunner1" wrote:

Hi guys,
been running macros (activated by buttons) to sort spreadsheet from
specific collumns e.g.

ActiveSheet.Unprotect
Range("B10:GJ89").Select
Selection.Sort Key1:=Range("CO10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("CO1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True
ActiveWindow.ScrollColumn = 91
End Sub


Now, having edited this worksheet, when I run each macro: it misses out the
top row e.g. row #10 but sorts the rest??????
Checked the macro and it hasn`t changed and this is happening to all my
macros now on this sheet. Use the same macros on similar sheets in workbook
and they still work fine. Sorted the sheet `by hand` and it sorts just fine.
Any ideas : I`m stuck until I get it sorted an on a deadline HELP!
Thanks
RR1

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 703
Default macro to sort is missing top row out???

Hi

In you sort statement, the Header property is set to xlGuess, and as
you want to sort all rows (no header) it seems that excel guess is
wrong.

Try to change to:

Header:= xlNo

Regards,
Per

On 28 Sep., 21:27, Romileyrunner1
wrote:
Hi guys,
been *running macros (activated by buttons) to sort spreadsheet from
specific collumns e.g.

ActiveSheet.Unprotect
* * Range("B10:GJ89").Select
* * Selection.Sort Key1:=Range("CO10"), Order1:=xlAscending,
Header:=xlGuess, _
* * * * OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
* * * * DataOption1:=xlSortNormal
* * Range("CO1").Select
* * ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
* * * * , AllowSorting:=True
* *ActiveWindow.ScrollColumn = 91
End Sub

Now, having edited this worksheet, when I run each macro: it misses out the
top row e.g. row #10 but sorts the rest??????
Checked the macro and it hasn`t changed and this is happening to all my
macros now on this sheet. Use the same macros on similar sheets in workbook
and they still work fine. Sorted the sheet `by hand` and it sorts just fine.
Any ideas : I`m stuck until I get it sorted an on a deadline HELP!
Thanks
RR1


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default macro to sort is missing top row out???


Yes, yes yes!!!
Well done that man.
Works fine now:
Brilliant work per
Thanks.

"Per Jessen" wrote:

Hi

In you sort statement, the Header property is set to xlGuess, and as
you want to sort all rows (no header) it seems that excel guess is
wrong.

Try to change to:

Header:= xlNo

Regards,
Per

On 28 Sep., 21:27, Romileyrunner1
wrote:
Hi guys,
been running macros (activated by buttons) to sort spreadsheet from
specific collumns e.g.

ActiveSheet.Unprotect
Range("B10:GJ89").Select
Selection.Sort Key1:=Range("CO10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("CO1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True
ActiveWindow.ScrollColumn = 91
End Sub

Now, having edited this worksheet, when I run each macro: it misses out the
top row e.g. row #10 but sorts the rest??????
Checked the macro and it hasn`t changed and this is happening to all my
macros now on this sheet. Use the same macros on similar sheets in workbook
and they still work fine. Sorted the sheet `by hand` and it sorts just fine.
Any ideas : I`m stuck until I get it sorted an on a deadline HELP!
Thanks
RR1



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 73
Default macro to sort is missing top row out???

Son of a gun Tom, well done you.
Works just as it should now.
Many thanks for your quick response.
Thanks Tom.
RR1

"Tom Hutchins" wrote:

Change
Header:=xlGuess
to
Header:=xlNo

You're letting Excel figure out if your data has a heading row (apparently
it doesn't, or you wouldn't want row 10 sorted). xlNo tells Excel that the
dta does not include a heading row.

Hope this helps,

Hutch

"Romileyrunner1" wrote:

Hi guys,
been running macros (activated by buttons) to sort spreadsheet from
specific collumns e.g.

ActiveSheet.Unprotect
Range("B10:GJ89").Select
Selection.Sort Key1:=Range("CO10"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=6, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("CO1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowSorting:=True
ActiveWindow.ScrollColumn = 91
End Sub


Now, having edited this worksheet, when I run each macro: it misses out the
top row e.g. row #10 but sorts the rest??????
Checked the macro and it hasn`t changed and this is happening to all my
macros now on this sheet. Use the same macros on similar sheets in workbook
and they still work fine. Sorted the sheet `by hand` and it sorts just fine.
Any ideas : I`m stuck until I get it sorted an on a deadline HELP!
Thanks
RR1

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing Macro Tim at alliant Excel Worksheet Functions 7 December 11th 08 09:29 PM
Missing sort ascending or descending when go into "data" "sort"? Jason Excel Discussion (Misc queries) 5 September 17th 08 11:57 PM
Missing a command in this macro jeannie v Excel Worksheet Functions 8 February 24th 08 07:29 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
How to sort/synchronise 2 data columns with missing records? Rik Excel Discussion (Misc queries) 3 February 24th 06 10:24 PM


All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"