Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I add these two lines to this code below
Range("M1") = Now Range("O1") = Now When I try to add them the code just hangs Thanks Private Sub Worksheet_Calculate() Dim i As Integer For i = 4 To 500 Call Worksheet_Change(Cells(i, 9)) Next End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim Line As Range On Error Resume Next With Target If .Row = 4 And .Row <= 500 And .Column = 9 Then Set Line = Range(Cells(.Row, 1), Cells(.Row, 13)) Select Case .Value Case vbNullString Line.Interior.ColorIndex = xlNone Case "POQA" Line.Interior.ColorIndex = 15 Case "IN PROCESS" Line.Interior.ColorIndex = 22 Case "INSERTING" Line.Interior.ColorIndex = 40 Case "STMTHAND" Line.Interior.ColorIndex = 38 Case "OD-M34" Line.Interior.ColorIndex = 50 Case Else Line.Interior.ColorIndex = 20 End Select End If End With End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() add brackets behind the Now = Now() or change the format Range(M1").value = Format(Now(),"mm-dd-yyyy") "Little Penny" wrote in message ... How can I add these two lines to this code below Range("M1") = Now Range("O1") = Now When I try to add them the code just hangs Thanks Private Sub Worksheet_Calculate() Dim i As Integer For i = 4 To 500 Call Worksheet_Change(Cells(i, 9)) Next End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim Line As Range On Error Resume Next With Target If .Row = 4 And .Row <= 500 And .Column = 9 Then Set Line = Range(Cells(.Row, 1), Cells(.Row, 13)) Select Case .Value Case vbNullString Line.Interior.ColorIndex = xlNone Case "POQA" Line.Interior.ColorIndex = 15 Case "IN PROCESS" Line.Interior.ColorIndex = 22 Case "INSERTING" Line.Interior.ColorIndex = 40 Case "STMTHAND" Line.Interior.ColorIndex = 38 Case "OD-M34" Line.Interior.ColorIndex = 50 Case Else Line.Interior.ColorIndex = 20 End Select End If End With End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code still hangs
I'm just looking to have the current date and time added when the worksheet is changed or a formula is updated. On Wed, 29 Nov 2006 21:33:13 -0500, Little Penny wrote: How can I add these two lines to this code below Range("M1") = Now Range("O1") = Now When I try to add them the code just hangs Thanks Private Sub Worksheet_Calculate() Dim i As Integer For i = 4 To 500 Call Worksheet_Change(Cells(i, 9)) Next End Sub Private Sub Worksheet_Change(ByVal Target As Range) Dim Line As Range On Error Resume Next With Target If .Row = 4 And .Row <= 500 And .Column = 9 Then Set Line = Range(Cells(.Row, 1), Cells(.Row, 13)) Select Case .Value Case vbNullString Line.Interior.ColorIndex = xlNone Case "POQA" Line.Interior.ColorIndex = 15 Case "IN PROCESS" Line.Interior.ColorIndex = 22 Case "INSERTING" Line.Interior.ColorIndex = 40 Case "STMTHAND" Line.Interior.ColorIndex = 38 Case "OD-M34" Line.Interior.ColorIndex = 50 Case Else Line.Interior.ColorIndex = 20 End Select End If End With End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Little Penny wrote in
: The code still hangs I'm just looking to have the current date and time added when the worksheet is changed or a formula is updated. 'You MUST turn off EnableEvents to prevent looping: on error goto err 'be sure to turn on events if an error occurs! Application.EnableEvents = False ..... do your stuff err: Application.EnableEvents = True On Wed, 29 Nov 2006 21:33:13 -0500, Little Penny wrote: How can I add these two lines to this code below Range("M1") = Now Range("O1") = Now -- bz please pardon my infinite ignorance, the set-of-things-I-do-not-know is an infinite set. remove ch100-5 to avoid spam trap |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disabling WORKSHEET_CHANGE event | Excel Discussion (Misc queries) | |||
Worksheet_change event. | Excel Programming | |||
Worksheet_change event | Excel Programming | |||
Worksheet_Change Event | Excel Programming | |||
Worksheet_Change Event | Excel Programming |