Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Error 91 in Autofilter

Hello!

The following code filters the values in a column for the value "y"
and then copies/combines the values of multiple cells in the same row
into other cells. There is probably a more efficient way of doing
this, but I haven't found it.

Here's the question - after successfully looping through all visible
rows, the code returns an error 91. As far as I can tell, it happens
when it reaches the last visible row. Is this why? How can I correct
it?

SrcEntRng.AutoFilter Field:=Range(PrefBAdd).Column,
Criteria1:="=y"
For Each MyCell In
Range(PrefBAdd).SpecialCells(xlCellTypeVisible)
' If MyCell.Value = "y" Then
MyCell.Offset(0, -13).Value =
Intersect(Rows(MyCell.Row), BAdd).Value _
& " " & Intersect(Rows(MyCell.Row),
BAdd.Offset(0, 1)).Value & " " _
& Intersect(Rows(MyCell.Row),
BAdd.Offset(0, 2)).Value & " " _
& Intersect(Rows(MyCell.Row),
BAdd.Offset(0, 3)).Value & " " _
& Intersect(Rows(MyCell.Row),
BAdd.Offset(0, 4)).Value
MyCell.Offset(0, -8).Value =
MyCell.Offset(0, 6).Value
MyCell.Offset(0, -7).Value =
MyCell.Offset(0, 7).Value
MyCell.Offset(0, -6).Value =
MyCell.Offset(0, 8).Value
MyCell.Offset(0, -5).Value =
MyCell.Offset(0, 9).Value
' End If
Next
SrcWS.AutoFilterMode = False
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
Excel Autofilter Error linglc Excel Discussion (Misc queries) 1 January 23rd 08 01:14 AM
Excel Autofilter error linglc Excel Discussion (Misc queries) 0 January 23rd 08 12:20 AM
Copy error with Autofilter Jonathan May[_3_] Excel Programming 0 July 15th 04 01:43 PM
autofilter macro causes #VALUE! error Jill[_7_] Excel Programming 3 May 5th 04 12:02 AM
VBA Autofilter error in '97, not 2000 Foggy Excel Programming 3 April 3rd 04 03:57 AM


All times are GMT +1. The time now is 09:55 AM.

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

About Us

"It's about Microsoft Excel"