Thread: referenced file
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
shawn shawn is offline
external usenet poster
 
Posts: 4
Default referenced file

Below is an example of a code I have behind sheet 1:
Private Sub Worksheet_Change(ByVal Target As Range)
If Worksheets("Password").Range("C16").Value = 1 Then
On Error Resume Next
Dim curComment As String
curComment = ""
curComment = Target.Comment.Text
If curComment < "" Then curComment = curComment &
Chr(10)
Target.AddComment
Target.Comment.Text Text:=curComment & _
Application.UserName & _
": Rev. " & Format(Date, "mm-dd-yyyy") & ", From
(" & Worksheets("Password").Range("A16").Value & ")"
End If
End Sub

This code adds a comments box to any cell in sheet1 that
is changed.

I also have this file referencing to another file. Most
of the code that runs this program is stored in the
referenced file to keep the original file's size small.

What I need to know is if I can take this code from behind
Sheet1 and place it in the referenced file in a module and
it work?

Or, is there a way to trigger a change event in sheet1,
cell A:1 some other way than by putting code behind sheet1
(in a referenced workbook)?