Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default two consecutive maros

Hi, can this two macro codes work in the same sheet? Both codes are working
separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default two consecutive maros

Hi.
No you must only have one "Worksheet_Change" macro. Try :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Address(False, False) = "B5" Then
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
ElseIf Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
Application.EnableEvents = False
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
Application.EnableEvents = True
End If
enditall:
End Sub

HTH
Daniel

Hi, can this two macro codes work in the same sheet? Both codes are working
separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
.Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default two consecutive maros

Its not working. I receive an error.
i have excel 2003. Maybe this is the problem?
Thanks!

"Daniel.C" a scris:

Hi.
No you must only have one "Worksheet_Change" macro. Try :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Address(False, False) = "B5" Then
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
ElseIf Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
Application.EnableEvents = False
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
Application.EnableEvents = True
End If
enditall:
End Sub

HTH
Daniel

Hi, can this two macro codes work in the same sheet? Both codes are working
separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
.Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default two consecutive maros

Indeed, i did not test it which error and which line is in error ?
Daniel

Its not working. I receive an error.
i have excel 2003. Maybe this is the problem?
Thanks!

"Daniel.C" a scris:

Hi.
No you must only have one "Worksheet_Change" macro. Try :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Address(False, False) = "B5" Then
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
ElseIf Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
Application.EnableEvents = False
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
Application.EnableEvents = True
End If
enditall:
End Sub

HTH
Daniel

Hi, can this two macro codes work in the same sheet? Both codes are working
separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
.Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default two consecutive maros

Hi,
When the error message appear, the fifth line is blue:
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
And after i click ok, the first line turn into yellow:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Thanks!

"Daniel.C" a scris:

Indeed, i did not test it which error and which line is in error ?
Daniel

Its not working. I receive an error.
i have excel 2003. Maybe this is the problem?
Thanks!

"Daniel.C" a scris:

Hi.
No you must only have one "Worksheet_Change" macro. Try :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Address(False, False) = "B5" Then
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
ElseIf Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
Application.EnableEvents = False
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
Application.EnableEvents = True
End If
enditall:
End Sub

HTH
Daniel

Hi, can this two macro codes work in the same sheet? Both codes are working
separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
.Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 133
Default two consecutive maros

Right. The line was splitted by the news reader; the following must be
on the same line :
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
Daniel

Hi,
When the error message appear, the fifth line is blue:
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
And after i click ok, the first line turn into yellow:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Thanks!

"Daniel.C" a scris:

Indeed, i did not test it which error and which line is in error ?
Daniel

Its not working. I receive an error.
i have excel 2003. Maybe this is the problem?
Thanks!

"Daniel.C" a scris:

Hi.
No you must only have one "Worksheet_Change" macro. Try :

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
If Target.Address(False, False) = "B5" Then
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))
ElseIf Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
Application.EnableEvents = False
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
..Value = Now
End If
End With
End If
Application.EnableEvents = True
End If
enditall:
End Sub

HTH
Daniel

Hi, can this two macro codes work in the same sheet? Both codes are
working separately, but not together.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "B5" Then _
Range("C1").Value = IIf(IsEmpty(Target), "", "" &
UCase(Format(Date, "dddd dd.mm.yyyy")))

End Sub
--------------------------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then
N = Target.Row
If Me.Range("A" & N).Value < "" Then
With Me.Range("B" & N)
If .Value = "" Then
.Value = Now
End If
End With
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Thanks!








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
Consecutive date range on consecutive worksheets john3478 Excel Worksheet Functions 3 January 14th 09 10:54 PM
Transposing data from consecutive rows into non-consecutive rows econ Excel Discussion (Misc queries) 0 March 10th 08 07:24 PM
Recording find Maros gwtechie72 New Users to Excel 1 January 23rd 08 10:09 PM
consecutive gotta know Excel Worksheet Functions 1 December 31st 06 10:34 PM
Consecutive Cells Stat Guy via OfficeKB.com Excel Worksheet Functions 1 May 26th 05 05:57 AM


All times are GMT +1. The time now is 09:38 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"