Hi
I am building a workbook to compile selected months into quarterly and perhaps semi-annual and annual reports.
I created a user form so the user can select the "Year", the "FirstMonth" and the "LastMonth". This works perfectly.
The full month name is part of each workbook containing information.
I would like to loop through these specific workbooks and extract the same data from each one. I have no problem getting it to loop through all the months or perform the tasks I require, but the part I am finding tricky is limiting it to only loop through the user defined selection of months.
I suspect I should be using For and To but normally only do this with numerical values, not arrays.
Any assistance or link to a similar solution would be appreciated.
I am building a workbook to compile selected months into quarterly and perhaps semi-annual and annual reports.
I created a user form so the user can select the "Year", the "FirstMonth" and the "LastMonth". This works perfectly.
The full month name is part of each workbook containing information.
I would like to loop through these specific workbooks and extract the same data from each one. I have no problem getting it to loop through all the months or perform the tasks I require, but the part I am finding tricky is limiting it to only loop through the user defined selection of months.
I suspect I should be using For and To but normally only do this with numerical values, not arrays.
Any assistance or link to a similar solution would be appreciated.

Code:
[COLOR=#0000ff]Option Explicit[/COLOR]
[COLOR=#0000ff]Sub [/COLOR]QuarterlyCompiler()
[COLOR=#0000ff]Dim [/COLOR]intYear [COLOR=#0000ff]As Integer[/COLOR]
[COLOR=#0000ff]Dim [/COLOR]strMonth [COLOR=#0000ff]As String[/COLOR]
[COLOR=#0000ff]Dim [/COLOR]strLastMonth [COLOR=#0000ff]As String[/COLOR]
[COLOR=#0000ff]Dim [/COLOR]varMonths [COLOR=#0000ff]As Variant[/COLOR]
[COLOR=#008000]'Show User Form
'On the user form, there are three comboboxes
'1: Select Year
'2: Select First Month
'3: Select Last Month[/COLOR]
frmSelectRangeOfMonths.Show
[COLOR=#008000]'This is where the user form deposits the selections[/COLOR]
intYear = Application.Sheets("InputBox").Range("A2")
strMonth = Application.Sheets("InputBox").Range("D19")
strLastMonth = Application.Sheets("InputBox").Range("E19")
[COLOR=#008000]'Array defined [/COLOR]
varMonths = Array("January", "February", "March", "April", "May", "June", "July", _
"August", "September", "October", "November", "December")
[COLOR=#008000]'Loop [/COLOR]
[COLOR=#0000ff]For Each [/COLOR]strMonth [COLOR=#0000ff]In [/COLOR]varMonths
Application.DisplayAlerts = False
Workbooks.Open "path is here" & intYearNo & "\Monthly Performance " & strMonth & ".xlsx"
[COLOR=#008000] 'Extraction Code Here[/COLOR]
ActiveWorkbook.Close (False)
Next strMonth
[COLOR=#008000]'Other Code Here[/COLOR]
[COLOR=#0000ff]
End Sub[/COLOR]