Hello, I have the following code, but not sure how to exclude top few lines
(as header) from being affected, to modify range.. thanks
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count gt; 1 Then Exit Sub
If Not Intersect(Me.Range(quot;AJ:AJquot;), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, quot;AGquot;)
.NumberFormat = quot;ddquot;
.Value = Now
End With
Application.EnableEvents = True
End If
If Not Intersect(Me.Range(quot;AO:ARquot;), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, quot;AUquot;)
.NumberFormat = quot;ddquot;
.Value = Now
End With
Application.EnableEvents = True
End If
End With
End Sub
Hi
Just insert a line saying
If Target.Row lt; 3 Exit Sub or whatever number of header rows you wish
to exclude - in this case exclude first 2 rows.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count gt; 1 Then Exit Sub
If Target.Row lt; 3 Then Exit Sub
If Not Intersect(Me.Range(quot;AJ:AJquot;), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, quot;AGquot;)
........
--
Regards
Roger Govierquot;nastechquot; gt; wrote in message
...
gt; Hello, I have the following code, but not sure how to exclude top few
gt; lines
gt; (as header) from being affected, to modify range.. thanks
gt;
gt; Option Explicit
gt; Private Sub Worksheet_Change(ByVal Target As Excel.Range)
gt; With Target
gt; If .Count gt; 1 Then Exit Sub
gt; If Not Intersect(Me.Range(quot;AJ:AJquot;), .Cells) Is Nothing Then
gt; Application.EnableEvents = False
gt; With Me.Cells(.Row, quot;AGquot;)
gt; .NumberFormat = quot;ddquot;
gt; .Value = Now
gt; End With
gt; Application.EnableEvents = True
gt; End If
gt; If Not Intersect(Me.Range(quot;AO:ARquot;), .Cells) Is Nothing Then
gt; Application.EnableEvents = False
gt; With Me.Cells(.Row, quot;AUquot;)
gt; .NumberFormat = quot;ddquot;
gt; .Value = Now
gt; End With
gt; Application.EnableEvents = True
gt; End If
gt; End With
gt; End Sub
gt;
gt;
- Feb 22 Thu 2007 20:35
Auto Date Script..
close
全站熱搜
留言列表
發表留言