C
CLR
Hi All.........
I have a little macro that works fine. However, I would like to change a
part of it that calls out the "other open workbook" to NOT be
hardcoded.......that is, to change the lines that read
Windows("ItemMaster.XLS").Activate
ActiveWindow.Close
to something that will do the same thing, but does not require the name
"ItemMaster.XLS" to be hard coded in, so that it will be selected no matter
what name it might be.
Here's the whole macro for reference....
Sub ObtainNewData()
Dim s As String
s = Range("MainMenu!c17").Value
If Range("c17").Value <> "" Then
Workbooks.Open FileName:=s
Else
MsgBox s & " Not found"
End If
Sheets("sheet1").Select
Sheets("sheet1").Copy After:=ThisWorkbook.Sheets("MainMenu")
Windows("ItemMaster.XLS").Activate
ActiveWindow.Close
Sheets("sheet1").Name = "ImportedData"
Sheets("MainMenu").Select
Range("e21").Select
End Sub
TIA
Vaya con Dios,
Chuck, CABGx3
I have a little macro that works fine. However, I would like to change a
part of it that calls out the "other open workbook" to NOT be
hardcoded.......that is, to change the lines that read
Windows("ItemMaster.XLS").Activate
ActiveWindow.Close
to something that will do the same thing, but does not require the name
"ItemMaster.XLS" to be hard coded in, so that it will be selected no matter
what name it might be.
Here's the whole macro for reference....
Sub ObtainNewData()
Dim s As String
s = Range("MainMenu!c17").Value
If Range("c17").Value <> "" Then
Workbooks.Open FileName:=s
Else
MsgBox s & " Not found"
End If
Sheets("sheet1").Select
Sheets("sheet1").Copy After:=ThisWorkbook.Sheets("MainMenu")
Windows("ItemMaster.XLS").Activate
ActiveWindow.Close
Sheets("sheet1").Name = "ImportedData"
Sheets("MainMenu").Select
Range("e21").Select
End Sub
TIA
Vaya con Dios,
Chuck, CABGx3