T
TimkenSteve
I am almost finished with a macro that reformats .csv into a report
then searches for a master log workbook and trasnfers and saves the
data. If the workbook cannot be found, I want excel to skip the cut and
paste part and simply save the workbook as "OrderStatus_All"
Any suggestions are greatly appriciated
Steve
'''''''''''''''''''''''''
'Transfer Data to Master'
'''''''''''''''''''''''''
'
'runs search for OrderStatus_All.xls'
Application.MoveAfterReturnDirection = xlDown
Application.MoveAfterReturn = True
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "c:\"
.SearchSubFolders = True
.MatchTextExactly = True
.Filename = "OrderStatus_All.xls"
If .Execute(msoSortByNone, msoSortOrderAscending, True) > 0 Then
End If
'counts the files in list and stores the value in total Count'
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
totalcount = .FoundFiles.Count
R = Range("A2").End(xlDown).Row
Range("A3" & CStr(R)).Select
Selection.Copy
'finds and opens if not creates and saves to default folder for
user documents'
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
Next i
ActiveSheet.Select
Columns("A:A").Select
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Offset(1,
0).Select
ActiveSheet.Paste
Rows(Range("A65536").End(xlUp).Row).Delete
End With
then searches for a master log workbook and trasnfers and saves the
data. If the workbook cannot be found, I want excel to skip the cut and
paste part and simply save the workbook as "OrderStatus_All"
Any suggestions are greatly appriciated
Steve
'''''''''''''''''''''''''
'Transfer Data to Master'
'''''''''''''''''''''''''
'
'runs search for OrderStatus_All.xls'
Application.MoveAfterReturnDirection = xlDown
Application.MoveAfterReturn = True
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = "c:\"
.SearchSubFolders = True
.MatchTextExactly = True
.Filename = "OrderStatus_All.xls"
If .Execute(msoSortByNone, msoSortOrderAscending, True) > 0 Then
End If
'counts the files in list and stores the value in total Count'
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
totalcount = .FoundFiles.Count
R = Range("A2").End(xlDown).Row
Range("A3" & CStr(R)).Select
Selection.Copy
'finds and opens if not creates and saves to default folder for
user documents'
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
Next i
ActiveSheet.Select
Columns("A:A").Select
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Offset(1,
0).Select
ActiveSheet.Paste
Rows(Range("A65536").End(xlUp).Row).Delete
End With