LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Set rng1 not working

I have:
Sub RepStats()
On Error Resume Next
Dim rng1 As range
Set myrng = Worksheets("Rep Page").range("A:A")
For Each c In myrng
If c < "" Then
Sheets("Rep Page").Select
em = c.Value
Sheets("Sheet1").Select
Selection.AutoFilter Field:=2, Criteria1:=em
With ActiveSheet.AutoFilter.range
On Error Resume Next
Set rng1 = Worksheets("Sheet1").Offset(1, 0).Resize(.Rows.Count - 1,
1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If rng1 Is Nothing Then
MsgBox em + " **No Data Found For This Rep**"
Else
Set rng = ActiveSheet.AutoFilter.range
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _
Destination:=Worksheets("Rep Page").range("B2")
End If

ActiveSheet.ShowAllData
Sheets("Rep Page").Select
End If
Next
End Sub

The line:
On Error Resume Next
Set rng1 = Worksheets("Sheet1").Offset(1, 0).Resize(.Rows.Count - 1,
1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0

Is not working. Can you help me. There is data that is filtered but it wont
copy, it just goes to:
If rng1 Is Nothing Then
MsgBox em + " **No Data Found For This Rep**"
 
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
IF not working amandooshna Excel Worksheet Functions 9 March 28th 07 02:11 PM
working Chris Lane Excel Worksheet Functions 2 November 19th 05 11:32 AM
Why is this not working? R.P.McMurphy Excel Discussion (Misc queries) 6 August 30th 05 09:34 PM
F4 Key not working.... Calvin Excel Discussion (Misc queries) 2 July 29th 05 09:03 AM
Working out UK tax hawkeye uk New Users to Excel 6 March 11th 05 04:23 PM


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