+ Reply to Thread
Results 1 to 2 of 2

Run except IF

Hybrid View

matt4003 Run except IF 04-25-2005, 01:48 PM
Norie Matt In the macro turn off... 04-25-2005, 02:55 PM
  1. #1
    Forum Contributor
    Join Date
    05-18-2004
    Location
    Portland, Oregon
    MS-Off Ver
    2016
    Posts
    182

    Exclamation Run except IF

    Hi,

    How would I get my below code NOT to run if Macro "Add_FCST" runs?????

    Dim vOldVal 'Must be at top of module



    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim bBold As Boolean
    If IsEmpty(vOldVal) Then vOldVal = "Empty Cell"
    bBold = Target.HasFormula
    With Sheet2
    '.Cells(2, 1) = Format(ThisWorkbook.BuiltinDocumentProperties("Last Save Time"), _
    '"short date")
    .Cells(4, 1) = "CELL CHANGED"
    .Cells(65536, 1).End(xlUp)(2, 1) = Target.Address
    .Cells(4, 2) = "OLD VALUE"
    .Cells(65536, 2).End(xlUp)(2, 1) = vOldVal
    With .Cells(4, 3)
    .Value = "NEW VALUE"
    .ClearComments
    .AddComment.Text Text:= _
    "Matt Kleinke:" & Chr(10) & "" & Chr(10) & _
    "Bold values are the results of formulas"
    End With
    With .Cells(65536, 3).End(xlUp)(2, 1)
    .Value = Target
    .Font.Bold = bBold
    End With
    .Cells(4, 4) = "TIME OF CHANGE"
    .Cells(65536, 4).End(xlUp)(2, 1) = Time
    .Cells(4, 5) = "DATE OF CHANGE"
    .Cells(65536, 5).End(xlUp)(2, 1) = Date
    .Cells(4, 6) = "CHANGED BY"
    .Cells(65536, 6).End(xlUp)(2, 1) = Application.UserName
    .Cells(4, 7) = "ENTERED DP"
    .Cells(65536, 7).End(xlUp)(2, 1) = "No"
    .Cells.Columns.AutoFit
    End With










    vOldVal = vbNullString
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    vOldVal = Target
    End Sub

    Thanks,
    Matt

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Matt

    In the macro turn off events at the start of the code.
    Application.EnableEvents = False
    Don't forget to turn them back on at the end of the code.
    Application.EnableEvents = True

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1