View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
robson soares[_2_] robson soares[_2_] is offline
external usenet poster
 
Posts: 1
Default the macro don't execute

it follows below my macro:

Private Sub Worksheet_Calculate()

Dim col1
Dim col2
Dim col3
Dim lin

lin = 13
col1 = 8
col2 = 12
col3 = 13


For lin = 13 To 2057

If Cells(lin, col1) = 1 And Cells(lin, col3) = 0 Then
Cells(lin, col3) = 1
Cells(lin, col2) = Now()
End If

If Cells(lin, col1) = 0 Then
Cells(lin, col3) = 0
Cells(lin, col2) = ""
End If

If Cells(lin, col1 + 1) = 1 And Cells(lin, col3 + 2) = 0 Then
Cells(lin, col3 + 2) = 1
Cells(lin, col2 + 2) = Now()
End If

If Cells(lin, col1 + 1) = 0 Then
Cells(lin, col3 + 2) = 0
Cells(lin, col2 + 2) = ""
End If

If Cells(lin, col1) = 1 And Cells(lin, col1 + 1) = 1 Then
Cells(lin, 11) = Abs(Cells(lin, 14) - Cells(lin, 12))
Else
Cells(lin, 11) = ""
End If

Next

End Sub





"Tom Ogilvy" escreveu:

http://www.cpearson.com/excel/events.htm
for an overview of events at Chip Pearson's site.

Sounds like you want to use the Change event or the Calculate event.

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Private Sub Worksheet_Calculate()

End Sub

Properly structured and located, these can be useful with the situation you
describe.

--
Regards,
Tom Ogilvy

"robson soares" <robson wrote in message
...
I wrote a code of macros in the VBA and it does not execute automatically
when I give a manual command to it execute, the macro functions normally

but
it never functions with the update of a cell of excel