Once I open a new workbook, how do I make it the active workbook to have a function make changes to it? Problem I am having is even after it is open, the function will only make changes to the workbook containing the Macro (Thisworkbook).
Private Sub ToggleButton1_Click() If ToggleButton1.Value = True Then ToggleButton1.Caption = "Autofax Buyer Names" ToggleButton1.BackColor = &HFF& ToggleButton1.ForeColor = &H0& Workbooks.Open Filename:="J:\Network Purchasing\CANCELLATIONS\MISC_Practice.xls" Range("E2:E50000").Replace What:="AA8983 - Amie Anderson", Replacement:="Anderson, Amie", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Else '... End If End Sub
Is there maybe a way to specify the external workbook in the Range? i.e.
^This is probably wrong, but I have tried multiple combinations of this code, based on examples from the net and can not figure out one that works.
Have never had any classes in VBA and only fiddled with macros a few times, so I am still learning the basic syntax.
Can someone please take a look at this: