Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Run-time error 91: Object Variable or With block variable not set

Can someone help me out with this error. I can't figure out what it means and
what the problem is in the code. pastdueWSlastRow=279

ActiveWorkbook.Worksheets("PAST DUE SITES").AutoFilter.Sort.SortFields.Add
Key _
:=Range("A3:A" & pastdueWSlastRow), SortOn:=xlSortOnValues,
Order:=xlAscending, _
DataOption:=xlSortNormal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Run-time error 91: Object Variable or With block variable not set

Try this instead

With ActiveWorkbook.Worksheets("PAST DUE SITES")
.Cells.AutoFilter
.Rows("3:" & pastdueWSlastRow).Sort _
header:=xlNo, _
Key:=Range("A3"), _
Order:=xlAscending
End With

"Ayo" wrote:

Can someone help me out with this error. I can't figure out what it means and
what the problem is in the code. pastdueWSlastRow=279

ActiveWorkbook.Worksheets("PAST DUE SITES").AutoFilter.Sort.SortFields.Add
Key _
:=Range("A3:A" & pastdueWSlastRow), SortOn:=xlSortOnValues,
Order:=xlAscending, _
DataOption:=xlSortNormal

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 '91': Object variable of With block variable not set jammin1911 Excel Programming 3 June 6th 06 06:36 PM
Getting inconsistent Error 91-Object variable or With block variable not set mfq Excel Programming 0 December 14th 05 06:08 PM
Run-time Error'91: Object variable or With block variable not set DynamiteSkippy Excel Programming 4 September 26th 05 07:47 AM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 06:35 AM.

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"