![]() |
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)? |
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)? |
All times are GMT +1. The time now is 11:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com