LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default IF statement but in code

Hi,
I have code which will add a comment box two cells to the right whenever a
date is placed in column "N".
There is text within this comment box which is added by the code and takes
the date from "N" and adds 14 (days).
On occasion, I will need to overide the 14 days with a number from column
"M" which is manually input into that cell.

So, in eccence, I need someting like:
If (M5="",N5+14,N5+M5) but in the following code:

Dim strTemp As Date
'adds a comment box to cells in column P when date is entered in N
On Error Resume Next
If Not Intersect(Target, Me.Range("N4:N9999")) Is Nothing Then
With Target
If .Value < "" Then
Application.EnableEvents = False
strTemp = Target.Offset(0, 3).Text
Target.Offset(0, 2).AddComment UserName() & " - AoS due by: " &
Format(Target.Value + 14, "dd mmm")
Target.Offset(0, 2).Comment.Shape.TextFrame.AutoSize = True
'On Error GoTo 0
Application.EnableEvents = True
End If
End With
End If


Any ideas???
--
Traa Dy Liooar

Jock
 
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
VBA code with and / or statement Steve Excel Programming 3 January 31st 08 11:47 PM
Help Identifying code statement Ayo Excel Discussion (Misc queries) 1 November 29th 07 03:50 AM
If statement to replace #VALUE! code jeannie v Excel Worksheet Functions 8 June 27th 07 03:53 AM
VBA code for IF statement with OR? Dave R. Excel Programming 4 June 27th 05 03:38 PM
Code doesn't go past first IF statement keepITcool Excel Programming 2 July 20th 04 09:48 PM


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