Invalid Qualifier

al.extreme

New Member
Joined
Nov 29, 2010
Messages
15
Hello
I,m trying to shift bewteen open workbooks that I previously open with another macro and recorded the names in a tab called "menu", range I4 to I6

the name of the workbooks change each week, so I try to use a variable
I previously used it with sucess for pivot tables pvt(count), but when I try to use the same principle for workbooks, I might be missing something when declaring the variables. I get the same error

Compile error:
Invalid Qualifier


and if I change to Dim wb(2 To 4) As Workbook I get the error:

ByRef Argument mismatch

any help?


this is the code
**************


Dim wb(2 To 4) As String
Dim Count As Long



wb(2) = Worksheets("menu").Range("I4").Value
wb(3) = Worksheets("menu").Range("I5").Value
wb(4) = Worksheets("menu").Range("I6").Value

For Count = 2 To 4

If IsFileOpen(wb(Count)) Then
Windows wb(Count).Activate
Else
MsgBox ("The Workbook " & wb(Count) & " is not open, please check file and try again!")
Exit Sub
End If
PivotCheck
Application.Calculation = xlCalculationManual
Dim pvtitem As PivotItem
With ActiveSheet.PivotTables(1).PivotFields("Calendar")

On Error Resume Next
.PivotItems(DataField_1).Visible = True
On Error GoTo 0
On Error Resume Next
.PivotItems(DataField_2).Visible = True
On Error GoTo 0
On Error Resume Next
.PivotItems(DataField_3).Visible = True
On Error GoTo 0


The code goes on....
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,570
Messages
6,179,611
Members
452,931
Latest member
The Monk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top