Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fid Fid is offline
external usenet poster
 
Posts: 2
Default Application-defined or object-defined error on simple sort

I have a very simple sort that is giving me an applicaiton-defined or
object defined error on the sort code. I know it is some sort of
problem with me quailifying objects or something which I do not
understand. All the code does is upon sheet activation read in a
single dimension array from one sheet, write it to another sheet and
then attempt to sort what was just written.

The code is not in a module but in the sheet object.

Dim StyleCount As Long
Dim ArrayStyleCount As Long
Dim StyleArray() As String
Dim SortRange As Range

Private Sub Worksheet_Activate()
Application.DisplayFormulaBar = False
CountStyles
ReadStyles
WriteStyles
End Sub

Sub CountStyles()
With Sheets("Data")
StyleCount = .Range(.Range("A3"),
..Range("A3").End(xlDown)).Rows.Count
End With
ReDim StyleArray(0 To StyleCount)
End Sub

Sub ReadStyles()
With Sheets("Data")
For ArrayStyleCount = 0 To StyleCount - 1
'Read in Style Number
StyleArray(ArrayStyleCount) =
..Range("A3").Offset(ArrayStyleCount, 0).Value
Next ArrayStyleCount
End With
End Sub

Sub WriteStyles()
With Sheets("StyleSort")
.Range("A1", .Cells(ArrayStyleCount + 1, 1)).Value = _
WorksheetFunction.Transpose(StyleArray)
.Range(.Range("A1"), .Range("A1").End(xlDown)).Sort 'GET ERROR
ON THIS LINE
End With
End Sub

I have been struggling with this for days and have done everyting that
I know to do to get it to work.

Thanks for any suggestions you can give me.

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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Runtime error 1004- application defined or object defined erro Novice Excel Programming 0 February 6th 06 09:34 PM
Runtime error 1004- application defined or object defined erro Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:29 PM
Application-Defined or Object-Defined Error on simple code Fid[_2_] Excel Programming 1 July 21st 05 08:30 PM
Application-Defined or Object-Defined Error on simple code [email protected] Excel Programming 6 February 22nd 05 09:03 PM


All times are GMT +1. The time now is 03:13 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"