Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 221
Default AutoFilter Cut/Copy not working with Name Range

G'day everyone

For the life of me, I have no idea why this doesn't work properly.

All I get returning is the first record

I know this workes when I specify the Criteria1="081001", but when I use the
same value via SIDLook Name Range

Sub Search_Copy_Student()

Dim SourceSheet As Worksheet
Dim DestinationSheet As Worksheet
Dim rng As Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Sheets("Exam Results").Select

Set SourceSheet = Sheets("Exam Results")
Set rng = SourceSheet.Range("A2:H" & Rows.Count)
Set DestinationSheet = Sheets("Student Select")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="SIDLook"

SourceSheet.AutoFilter.Range.Copy
DestinationSheet.Select
Range("C2").Select
Selection.PasteSpecial xlPasteValues
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

TIA
Mark.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default AutoFilter Cut/Copy not working with Name Range

It's looking for the value of "SIDLook" in column 1. Is that what you want?
If not, you'll need to come and tell us what you want.

I'm going to assume for a minute that SIDLook is a named range referring to
a cell somewhere. If this is what you want, you'll need to change some of
your code.

rng.AutoFilter Field:=1, Criteria1:=Range("SIDLook").value

--
HTH,
Barb Reinhardt




"NoodNutt" wrote:

G'day everyone

For the life of me, I have no idea why this doesn't work properly.

All I get returning is the first record

I know this workes when I specify the Criteria1="081001", but when I use the
same value via SIDLook Name Range

Sub Search_Copy_Student()

Dim SourceSheet As Worksheet
Dim DestinationSheet As Worksheet
Dim rng As Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Sheets("Exam Results").Select

Set SourceSheet = Sheets("Exam Results")
Set rng = SourceSheet.Range("A2:H" & Rows.Count)
Set DestinationSheet = Sheets("Student Select")

SourceSheet.AutoFilterMode = False
rng.AutoFilter Field:=1, Criteria1:="SIDLook"

SourceSheet.AutoFilter.Range.Copy
DestinationSheet.Select
Range("C2").Select
Selection.PasteSpecial xlPasteValues
Application.CutCopyMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End Sub

TIA
Mark.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 221
Default AutoFilter Cut/Copy not working with Name Range

G'day Barb

Thx heaps for the pointer, worked like a charm.

Many thx

Regards
Mark.


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
AutoFilter Not Working MKing Excel Worksheet Functions 0 March 28th 07 02:09 AM
AutoFilter Not Working Teethless mama Excel Worksheet Functions 0 March 28th 07 01:10 AM
autofilter not working ACTBOB Excel Discussion (Misc queries) 2 July 21st 06 10:16 PM
Autofilter not working correctly... Emily Excel Discussion (Misc queries) 0 January 11th 06 10:37 PM
Autofilter Not working cyndi Excel Discussion (Misc queries) 3 February 14th 05 10:29 PM


All times are GMT +1. The time now is 11:45 PM.

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"