Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel 2002 & WinXP
The following macro simply arranges (sorts) the sheets in the order of an existing list. The variable "c" is declared as Long. Hovering the mouse pointer over the variables (after debug) results in: SortList.Count = 25 'Correct SortList(c) = "WYRI" 'Correct, last name in the list. The error occurred in the first loop of the For loop. The error is "Type Mismatch". The offending line is: Sheets(SortList(c)).Move Befo=Sheets(1) For troubleshooting I put a message box before the For loop asking for SortList.Address and SortList.Parent.Name. Both are correct. What is happening to cause a "Type Mismatch" error? Thanks for your help. Otto Sub SortByAPAQ() Dim SortList As Range With Sheets("Utility") If WhichSort = "AP3" Then Set SortList = .Range("AP3", .Range("AP" & Rows.Count).End(xlUp)) Else Set SortList = .Range("AQ3", .Range("AQ" & Rows.Count).End(xlUp)) End If End With For c = SortList.Count To 1 Step -1 Sheets(SortList(c)).Move Befo=Sheets(1) Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Type mismatch using rnge as Range with Type 8 Input Box | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
13 type mismatch help | Excel Programming | |||
Type Mismatch | Excel Programming | |||
Type mismatch | Excel Programming |