#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Macro range

Hi, i need this code to run from "A5".
Can this be done?
Thanks!

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 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default Macro range

try to replace

If Target.Cells.Column = 1 Then

with

If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then


On 8 Kwi, 14:20, puiuluipui
wrote:
Hi, i need this code to run from "A5".
Can this be done?
Thanks!

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 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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Macro range

Its working! Thanks!

"Jarek Kujawa" a scris:

try to replace

If Target.Cells.Column = 1 Then

with

If Target.Cells.Column = 1 And Target.Cells.Row = 5 Then


On 8 Kwi, 14:20, puiuluipui
wrote:
Hi, i need this code to run from "A5".
Can this be done?
Thanks!

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 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



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Macro range

Add

if target.row < 6 then exit sub

right near the top.

puiuluipui wrote:

Hi, i need this code to run from "A5".
Can this be done?
Thanks!

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 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


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Macro range

Its working! Thanks!

"Dave Peterson" a scris:

Add

if target.row < 6 then exit sub

right near the top.

puiuluipui wrote:

Hi, i need this code to run from "A5".
Can this be done?
Thanks!

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 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


--

Dave Peterson



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
How to use a range name in a macro CompetiveLat Excel Worksheet Functions 2 July 22nd 08 06:40 PM
Macro deletes row in range, macro then skips the row moved up steven.holloway Excel Discussion (Misc queries) 8 June 11th 08 11:40 AM
macro pop-up to set range? NPell Excel Worksheet Functions 0 April 25th 08 03:48 PM
Macro Range mbnspect Excel Discussion (Misc queries) 2 January 17th 08 05:38 AM
Name a Range - Macro Danny Excel Worksheet Functions 0 October 14th 05 05:24 AM


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