![]() |
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! |
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! |
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! |
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! |
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! |
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! |
two consecutive maros
I have now, a new error, just like the first time, but now with blue (12
line) is : ...Value = Now ....and after i click ok, with yellow, i have (first line): Private Sub Worksheet_Change(ByVal Target As Excel.Range) Thanks! "Daniel.C" a scris: 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! |
two consecutive maros
I am sorry. I don't know why the code is altered; there is only one dot
: ..Value = Now (read: dot value equal now) for any further error, refer to your initial code. Daniel I have now, a new error, just like the first time, but now with blue (12 line) is : ..Value = Now ...and after i click ok, with yellow, i have (first line): Private Sub Worksheet_Change(ByVal Target As Excel.Range) Thanks! "Daniel.C" a scris: 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! |
two consecutive maros
Hi. Sorry for my late reply...it's working. i just had to replace "B5" with
"C5". First code generate result in "B5" and the second one from "B5". But i had to double click "B5" to make the second code to work. So, i replace the "B5" with "C5", because my database allowed me to do that. And now it's working. Thanks allot! "Daniel.C" a scris: 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! |
All times are GMT +1. The time now is 11:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com