Solved

Require your help for highlighted field

Posted on 2011-02-24
2
327 Views
Last Modified: 2012-05-11
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
 
Dim bBold As Boolean
 
 
 
If Target.Cells.Count > 1 Then Exit Sub
 
On Error Resume Next
 
 
 
    With Application
 
         .ScreenUpdating = False
 
         .EnableEvents = False
 
    End With
 
 
 
    If IsEmpty(vOldVal) Then vOldVal = "Empty Cell"
 
    bBold = Target.HasFormula
 
        With Sheet1
 
            .Unprotect Password:="Secret"
 
                If .Range("A1") = vbNullString Then
 
                    .Range("A1:E1") = Array("CELL CHANGED", "OLD VALUE", _
                        "NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE" “ USER WHO MADE CHANGE”)
 
                End If
 
 
 
 
 
            With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
 
                  .Value = Target.Address
 
                  .Offset(0, 1) = vOldVal
 
                      With .Offset(0, 2)
 
                        If bBold = True Then
 
                          .ClearComments
 
                          .AddComment.Text Text:= _
"OzGrid.com:" & Chr(10) & "" & Chr(10) & _
                                  "Bold values are the results of formulas"
 
                        End If
 
                          .Value = Target
 
                          .Font.Bold = bBold
 
                      End With
 
 
 
                .Offset(0, 3) = Time
 
                .Offset(0, 4) = Date
 
            End With
 
            .Cells.Columns.AutoFit
 
            .Protect Password:="Secret"
 
        End With
 
    vOldVal = vbNullString
 
    End With
 
.user = Target
 
    With Application
 
         .ScreenUpdating = True
 
         .EnableEvents = True
 
    End With
 
 
 
On Error GoTo 0
 
 
 
End Sub
 
0
Comment
Question by:mohantyd
  • 2
2 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 34975771
Hello,

could you flesh out the question a bit? Is something not working? Is a line of code giving you trouble? If so, what? Where? Any error message?

cheers, teylyn
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 34975799
There seems to be a problem on this line

 
                    .Range("A1:E1") = Array("CELL CHANGED", "OLD VALUE", _
                        "NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE" “ USER WHO MADE CHANGE”)

Change it to

                    .Range("A1:E1") = Array("CELL CHANGED", "OLD VALUE", _
                        "NEW VALUE", "TIME OF CHANGE", "DATE OF CHANGE", "USER WHO MADE CHANGE")

The difference is a missing comma before and correct quote marks around USER WHO MADE CHANGE
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
modifying VBScript to VBA 17 73
Converting time 4 41
VB.Net  Exporting Excel Woorkbook to PDF 7 60
Vba code to spell check an excel document in a set range 9 29
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question