Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to not execute Worksheet_Change while making changes to it via
Hi everyone,
With the great help of Lenze (MrExcel MVP), I managed to modify his code to suit my needs but the issue is that I only need it to work in GUI and not while I am coping or manipulating via code (i.e.: Workbooks("Book1.xls").Worksheets("").Cells(1,1).V alue = workbooks("Book1.xls").worksheets("").cells(1,1).v alue. Anywayes, my questions is as to how do I prevent or stop this code execution when I am extracting data into this sheet from another workbook i have a code that extract automatically)... I managed to do this via programming in VBE (assigning the following code behinde the sheet after the extraction from other workbook is complete) but then this requires all users to check €˜trust Visual Basic checkbox and I do not know who is going to be using this workbook. I also tried something to do with, if workbook... worksheet("Data").activate = false then do not execute the code, otherwise, do. Had no luck thus far. Any help/tip would be much appreciated. Adnan Option Explicit Public preValue As Variant Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column 2 And Target.Column < 16 Then ActiveSheet.Cells(Target.Row, 2) = Cells(Target.Row, 2).Value & Chr(10) & "Previous Value was " _ & preValue & Chr(10) & "Revised " & Format(Now(), "m/d/yy h:mm;@") & Chr(10) & "By " & Environ("UserName") End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count 1 Then Exit Sub If Target = "" Then preValue = "a blank" Else: preValue = Target.Value End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Execute Worksheet_Change before recalculation | Excel Programming | |||
Worksheet_Change event won't fire to execute Macro??? | Excel Programming | |||
worksheet_change vs. calculate, and worksheet_change not running | Excel Programming | |||
worksheet_change vs. calculate, and worksheet_change not running | Excel Programming |