I hope someone can help me because I have tried many suggestions from other sites, but can not find the solution.
I have 2 workbooks. One contains the list of fields to be copied to the other. So far looks very easy, but when I try to assign the sheet name to variable, it does not store it so I am not able to return that sheet later.
I will give you an example
Function getActiveWBName()
getActiveWBName = ActiveWorkbook.NAME
End Function
Dim homeWB
Sub pull_data()
Set homeWB = Workbooks(getActiveWBName)
homeWB.Activate
Call Update_List
End Sub
Sub Update_List()
Workbooks.Open Filename:=FullFilePath, UpdateLinks:=3
Sheets("List").Activate
Cells.Select
Selection.Copy
ActiveWorkbook.Close
homeWB.Activate
Sheets("List").Activate
Range("A1").Select
Selection.Paste
End Sub
After getting to homeWB.activate
in the sub Update_List
it returns runtime error 424 - Object required.
What am I doing wrong?
I would like to retain the function that returns active sheet name.
Can anyone please help me with this?