Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 447
Default Event Change code

I want to be able to track changes made to a spreadsheet by users by changing
the colour of the cells.

worksheet name is cost by vehicle and the range that needs to be covered is
G1:k800. I'd like any cells changed to change to a red background.

I know this is a worksheet change event, but I don't have any idea how to do
it. Can anyone point me in the right direction please.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Event Change code

there are MANY ways to do this. Take a look at these options:
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("a1:iv65536")
If Intersect(Target, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
Cells(Target.Row, "Z").Value = Environ("username")
Application.EnableEvents = True
End Sub
(In a sheet, not a module)

Function MyUserName() As String
MyUserName = Environ("UserName")
End Function

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("$A$1:$BB$4000")) Is Nothing Then
Application.EnableEvents = False
Application.ScreenUpdating = False
With Worksheets("Sheet2")
..Select
..Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = Target.Address
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Target.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Now()
ActiveCell.NumberFormat = "mm/dd/yy"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = MyUserName()
Application.EnableEvents = True
Application.ScreenUpdating = True
End With
End If
End Sub
(In a sheet, not a module)


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 1).ClearContents
Else
With .Offset(0, 1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
End Sub
(In a sheet, not a module)


Regards,
Ryan---

--
RyGuy


"karen" wrote:

I want to be able to track changes made to a spreadsheet by users by changing
the colour of the cells.

worksheet name is cost by vehicle and the range that needs to be covered is
G1:k800. I'd like any cells changed to change to a red background.

I know this is a worksheet change event, but I don't have any idea how to do
it. Can anyone point me in the right direction please.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Event Change code

Right click the sheet you wnat to colour code and add the following...

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Intersect(Target, Range("G1:K800")).Interior.ColorIndex = 3
On Error GoTo 0
End Sub
--
HTH...

Jim Thomlinson


"karen" wrote:

I want to be able to track changes made to a spreadsheet by users by changing
the colour of the cells.

worksheet name is cost by vehicle and the range that needs to be covered is
G1:k800. I'd like any cells changed to change to a red background.

I know this is a worksheet change event, but I don't have any idea how to do
it. Can anyone point me in the right direction please.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet Change event code, but retain Undo? mark Excel Programming 11 September 13th 07 08:40 PM
Event code to continuously monitor change Ybor Tony Excel Programming 3 October 20th 06 05:09 PM
Need code for simple change event Jake[_8_] Excel Programming 2 May 14th 04 11:29 PM
Excel 2000 ComboBox Code Change event Matt. Excel Programming 3 July 28th 03 03:29 PM


All times are GMT +1. The time now is 05:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"