Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet referenced in same file as variable in formula? | Excel Discussion (Misc queries) | |||
Xla file being referenced in the cell | Excel Discussion (Misc queries) | |||
Links error if referenced file not opened | Excel Worksheet Functions | |||
.xls file keeps referenced addin(.xla) filepath? | Excel Programming | |||
Changing the name of a referenced file | Excel Programming |