#1   Report Post  
Posted to microsoft.public.excel.misc
nastech
 
Posts: n/a
Default too many dates macro

Hi, was wondering if possible to modify a date script to exclude lines that
(?) have a period in the first cell? A$1..? Thanks

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Me.Range("AK:AK"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AH")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
If Not Intersect(Me.Range("AR:AU"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AY")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default too many dates macro

Column A of the row that got the change?

With Target
If .Count 1 Then Exit Sub
'just a dot?
if me.cells(.row,"A").value = "." then exit sub
'or contains a dot?
if instr(1,me.cells(.row,"A").value,".",vbtextcompare ) 0 then
exit sub
end if
If Not Intersect(Me.Range("AK:AK"), .Cells) Is Nothing Then

nastech wrote:

Hi, was wondering if possible to modify a date script to exclude lines that
(?) have a period in the first cell? A$1..? Thanks

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Me.Range("AK:AK"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AH")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
If Not Intersect(Me.Range("AR:AU"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AY")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
End With
End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
nastech
 
Posts: n/a
Default too many dates macro

thankyou sir..

"Dave Peterson" wrote:

Column A of the row that got the change?

With Target
If .Count 1 Then Exit Sub
'just a dot?
if me.cells(.row,"A").value = "." then exit sub
'or contains a dot?
if instr(1,me.cells(.row,"A").value,".",vbtextcompare ) 0 then
exit sub
end if
If Not Intersect(Me.Range("AK:AK"), .Cells) Is Nothing Then

nastech wrote:

Hi, was wondering if possible to modify a date script to exclude lines that
(?) have a period in the first cell? A$1..? Thanks

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Me.Range("AK:AK"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AH")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
If Not Intersect(Me.Range("AR:AU"), .Cells) Is Nothing Then
Application.EnableEvents = False
With Me.Cells(.Row, "AY")
.NumberFormat = "dd"
.Value = Now
End With
Application.EnableEvents = True
End If
End With
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
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
automatic macro update boconnell Excel Worksheet Functions 4 February 9th 05 07:10 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro Formula revision? Mark Excel Worksheet Functions 1 November 28th 04 01:43 AM


All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"