I have two Excel files with the following names:
FY16-Payroll_Hours_Report_New
PPE102815
Both are macro enabled, and they are located under the following path:
"G:\1. Payroll Files\2016\FY16-Payroll_Hours_Report_New.xlsm"
"G:\1. Payroll Files\2016\PPE102815.xlsm"
The following code was provided by NoSparks and is currently located in the file named "FY16-Payroll_Hours_Report_New".
Code:
Sub testing()
Dim ws As Worksheet, fndRng As Range
For Each ws In ThisWorkbook.Sheets
With ws.Range("Y:Y")
Set fndRng = .Find(What:="G", LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
If Not fndRng Is Nothing Then
fndRng.Offset(-1).Resize(, 2).Value = fndRng.Resize(, 2).Value
fndRng.EntireRow.Delete
End If
End With
Next ws
End Sub
Currently, I'm running the following code from this file "FY16-Payroll_Hours_Report_New" to open the PPE102815 file, saving it as macro enabled, and activating the workbook but when I run the above macro it doesn't work.
Code:
Sub Set_Open_ExistingWorkbook()
Dim wkb As Workbook
Set wkb = Workbooks.Open("G:\1. Payroll Files\2016\PPE102815.xls")
End Sub
Sub SaveWorkBookAsMacroEnable()
'
' Macro1 Macro
'
'
ActiveWorkbook.SaveAs Filename:="G:\1. Payroll Files\2016\PPE102815.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Sub Activate_Payroll_File()
Workbooks("PPE102815.xlsm").Activate
End Sub
With your help, I would like to be able to run this macro from the current location of the macro ( "FY16-Payroll_Hours_Report_New") so it can run or apply the macro to the file "PPE102815 ".
Hope someone can help.
Thank you in advance for your assistance and cooperation.
Regards,
rsrasc