Activate Range in Worksheet Loop
Posted on 2011-03-23
I have a macro that loops through multiple worksheets and filters a row based on a user selection. When it gets to the second worksheet, it throws the error "Select method of Range Class Failed."
I think this might be because the second sheet is active but it's trying to select the range on the first sheet, but i don't know what I'm doing wrong... can you help?
Dim FilterRange As Range
Set FilterRange = Application.InputBox(Prompt:= _
"Please select the Row to be Filtered", _
Title:="Filter Range", Type:=8)
If FilterRange Is Nothing Then
On Error GoTo 0
Dim i As Integer
For i = 1 To Sheets.Count
ActiveWindow.View = xlNormalView