Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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)?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default referenced file

you can instantiate application level events and have your code in the
referenced workbook.

see Chip Pearson's page on Application level events

http://www.cpearson.com/excel/appevent.htm

--
Regards,
Tom Ogilvy



"shawn" wrote in message
...
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)?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet referenced in same file as variable in formula? dhod Excel Discussion (Misc queries) 0 November 19th 07 07:09 PM
Xla file being referenced in the cell Sandeep Excel Discussion (Misc queries) 3 July 11th 07 11:44 AM
Links error if referenced file not opened supergalaxygirl Excel Worksheet Functions 2 April 3rd 06 06:00 AM
.xls file keeps referenced addin(.xla) filepath? Conceptor[_2_] Excel Programming 1 February 5th 04 11:33 AM
Changing the name of a referenced file Colleen[_2_] Excel Programming 1 December 12th 03 06:54 PM


All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"