Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Runtime Error on Simple Sort

I have the following Code:

Sub CmdSortMe_Click()
UnprotectAll
'above routine unprotects current workbook and worksheet
CreateAllStyleList
'above routine gathers data from 3 worksheets into and array and
writes array to Worksheet("Cost&Margin")

With Worksheets("Cost&Margin")
Dim rg As Range
Set rg = Range("StyleRange")
rg.Sort key1:=rg, order1:=xlAscending
ProtectAll 'routine protects current worksheet and workbook
End With
End Sub

I get the "Run-time error '1004': Application-defined or
object-defined error on the code that sorts.
If I omit calling subroutine CreatAllStyleList the sort code executes
without error.

What am I doing wrong?

Thanks,

Brent

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
xpath error? Runtime Error 13 type mismatch SteveM Excel Discussion (Misc queries) 1 December 4th 07 09:16 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


All times are GMT +1. The time now is 11:50 PM.

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

About Us

"It's about Microsoft Excel"