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 |
All times are GMT +1. The time now is 12:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com