This won't work.
Target is still a range that points to the cells that changed in the original
worksheet. (I don't think that's what you want.)
Maybe...
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wks As Worksheet
Set wks = Workbooks("code.xls").Worksheets("sheet2")
With wks
Application.Run "'" & .Parent.Name & "'!" _
& .CodeName & ".Worksheet_SelectionChange", .Range(Target.Address)
End With
End Sub
Dave Peterson wrote:
You know the sheet codename/module name that should be called, right.
I used Sheet2 (just to be different).
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkbk As Workbook
Set wkbk = Workbooks("Code.xls")
Application.Run _
"'" & wkbk.Name & "'!sheet2.Worksheet_SelectionChange", Target
End Sub
wrote:
Hi,
I'm using the following code to do a call for a function in a workbook
called "Code"
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.Run ("Code.xls!ModuleWorksheet_SelectionChange(Target) ")
End Sub
This code is in my primary project. However I receive an error that
say's the Macro cannot be found.
The "Code.xls" is in a workbook that holds of the codes I wish to use
in my project.(different workbook)
I've used various formats for the above code found on this forum.
Using Excel 2003 windows XP
Any help would be great.
Thanks
--
Dave Peterson
--
Dave Peterson