J
James Stephens
This is a follow up to a previous post - but I have got a much better start
Here is what I have put together so far
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:="January
.Columns("A:I").AutoFilter Field:=9, Criteria1:="2004
.Columns("A:I").SpecialCells(xlCellTypeVisible).Cop
If Dir(ThisWorkbook.Path & "\ProgramData\FileData\StoredData\January2004.xls") <> "" The
'Ope
Workbooks.Open (ThisWorkbook.Path & "\ProgramData\FileData\StoredData\January2004.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("D
").AutoFilte
End Wit
Application.DisplayAlerts = Tru
End Su
I have a couple of issues to fix though. I need to make sure that it appends the data that is being copied at the end of whatever current data exists. Also as before all of this contains hard coded values and I have to change that, but I am completely clueless as to how to do that. It has to do the sort for date (month and year) copy that and then open or creat the file based on that date - paste the data - then continue through the origional file and take out any other month and year that is available. (as before no origional data file will contain more than three combinations of month and year).So basically all of the code above where it says "January2004", that value would have to come from the data sorted and the value in fields 8 & 9
Any help on this would be greatly appreciated, as this is really my only hold up, after this I just have to generate reports off of this data, and all of that I know how to do
Thanks in advance for any help or advice
James Stephens
Here is what I have put together so far
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:="January
.Columns("A:I").AutoFilter Field:=9, Criteria1:="2004
.Columns("A:I").SpecialCells(xlCellTypeVisible).Cop
If Dir(ThisWorkbook.Path & "\ProgramData\FileData\StoredData\January2004.xls") <> "" The
'Ope
Workbooks.Open (ThisWorkbook.Path & "\ProgramData\FileData\StoredData\January2004.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("D
End Wit
Application.DisplayAlerts = Tru
End Su
I have a couple of issues to fix though. I need to make sure that it appends the data that is being copied at the end of whatever current data exists. Also as before all of this contains hard coded values and I have to change that, but I am completely clueless as to how to do that. It has to do the sort for date (month and year) copy that and then open or creat the file based on that date - paste the data - then continue through the origional file and take out any other month and year that is available. (as before no origional data file will contain more than three combinations of month and year).So basically all of the code above where it says "January2004", that value would have to come from the data sorted and the value in fields 8 & 9
Any help on this would be greatly appreciated, as this is really my only hold up, after this I just have to generate reports off of this data, and all of that I know how to do
Thanks in advance for any help or advice
James Stephens