View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Can you use "Target" in a Module besides the worksheet module

I think what you want is to pass the target to that other routine?

You'll still need that worksheet (workbook?) event to call that routine, though.

For instance, I used this code behind the worksheet:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Call myOtherSub(Target.Cells(1))
End Sub

And this code in a General module:
Option Explicit
Sub myOtherSub(myCell As Range)
MsgBox myCell.Address(0, 0)
End Sub

Whenever I change anything in the worksheet, I pass the first cell in the
changed range to the myOtherSub routine.


wrote:

I'm making an order entry program and Im wondering if there is a way
to refer to the target in any module, not just the worksheet module


--

Dave Peterson