G
Guest
This is similiar to a previous post but I think I have my problem reduced even further. I think all I need here is to set up an array and pass the value of that through my current macro. There are 4 places were the value of the array would need to be inputed (as seen below <--Value From Array-->). The values for the array will be on "sheet2" of the "ReportOne.xls" file, in column "E".There will be anywhere from 1 to 4 values there. The data that the autofilter is filtering will be on "sheet1" of "ReportOne.xls". I need to loop through my current macro passing into it in those four places each value from the array
My problem is I don't really know how to use arrays, especially in this manner - I think it is all I need - and this is the only solution I can put together that can come close to figuring out for my problem. Any help on this would be great. This is as far as I can take this alone
Sub FindOrCreate(
Application.DisplayAlerts = Fals
Dim MyPath As Strin
Dim sh As Workshee
Workbooks.Open (ThisWorkbook.Path & "\ReportOne.xls"
Set sh = ActiveWorkbook.ActiveShee
With s
.Columns("A:I").AutoFilter Field:=8, Criteria1:= <--Value From Array--
.Columns("A:I").SpecialCells(xlCellTypeVisible).Cop
If Dir(ThisWorkbook.Path & "\ProgramData\FileData\StoredData\ <--Value From Array-->") <> "" The
'Ope
Workbooks.Open (ThisWorkbook.Path & "\ProgramData\FileData\StoredData\
<--Value From Array-->" & ".xls"
Els
'Creat
Workbooks.Ad
Sheets("Sheet2").Selec
ActiveWindow.SelectedSheets.Delet
Sheets("Sheet3").Selec
ActiveWindow.SelectedSheets.Delet
End I
Sheets("Sheet1").Range("A1").PasteSpecia
.Columns("I:I").AutoFilte
.SaveAs Filename:=ThisWorkbook.Path & "\ProgramData\FileData\StoredData\
<--Value From Array-->" & ".xls"
FileFormat:=xlNormal,
Password:="",
WriteResPassword:="",
ReadOnlyRecommended:=False,
CreateBackup:=Fals
.Clos
End Wit
Application.DisplayAlerts = Tru
End Su
Thanks in advance for your time
Jim
My problem is I don't really know how to use arrays, especially in this manner - I think it is all I need - and this is the only solution I can put together that can come close to figuring out for my problem. Any help on this would be great. This is as far as I can take this alone
Sub FindOrCreate(
Application.DisplayAlerts = Fals
Dim MyPath As Strin
Dim sh As Workshee
Workbooks.Open (ThisWorkbook.Path & "\ReportOne.xls"
Set sh = ActiveWorkbook.ActiveShee
With s
.Columns("A:I").AutoFilter Field:=8, Criteria1:= <--Value From Array--
.Columns("A:I").SpecialCells(xlCellTypeVisible).Cop
If Dir(ThisWorkbook.Path & "\ProgramData\FileData\StoredData\ <--Value From Array-->") <> "" The
'Ope
Workbooks.Open (ThisWorkbook.Path & "\ProgramData\FileData\StoredData\
<--Value From Array-->" & ".xls"
Els
'Creat
Workbooks.Ad
Sheets("Sheet2").Selec
ActiveWindow.SelectedSheets.Delet
Sheets("Sheet3").Selec
ActiveWindow.SelectedSheets.Delet
End I
Sheets("Sheet1").Range("A1").PasteSpecia
.Columns("I:I").AutoFilte
.SaveAs Filename:=ThisWorkbook.Path & "\ProgramData\FileData\StoredData\
<--Value From Array-->" & ".xls"
FileFormat:=xlNormal,
Password:="",
WriteResPassword:="",
ReadOnlyRecommended:=False,
CreateBackup:=Fals
.Clos
End Wit
Application.DisplayAlerts = Tru
End Su
Thanks in advance for your time
Jim