Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default If help. Multible IF's

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

The thing is that it does everything except:
With ActiveSheet.AutoFilter.range
On Error Resume Next
Set rng11 = .Offset(1, 0).Resize(.Rows.Count - 1, _
1).SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If rng11 Is Nothing Then
MsgBox em + " **No Data Found For This Rep**"

Jt just goes to:
Else
range("B:B").EntireColumn.Hidden = True
Set rng = ActiveSheet.AutoFilter.range
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _
Destination:=Worksheets("Rep Page").range(c.Address).Offset(0, 1)
End If

And copies the entire sheet, not the filtered data.

HElp.

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
Open Multible Instances of Excel AJOLSON Excel Discussion (Misc queries) 3 September 15th 09 03:12 PM
How do you merge multible rows of a table? DaveK New Users to Excel 2 November 3rd 08 08:17 PM
Help getting multible subs to work together Mekinnik Excel Programming 0 October 23rd 07 05:27 PM
SUM(IF(multible conditions)) frenchy Excel Worksheet Functions 2 September 21st 06 10:58 PM
Union across multible worksheets Jeff Excel Programming 1 September 29th 04 12:48 AM


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