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: 8
Default Help with user function please

I want the following function to return either a string
(in the form DDMMMYYYY or HHMM), or just a blank if the
parameter INDATE hasn't been completed. The date/time
adding bit works OK, but if INDATE is blank the function
returns #VALUE!. It wouldn't matter except that the
#VALUE! response causes problems with a seperate importing
program. Is there any way I can fix it?

(INDATE and INTIME are strings in the form DDMMMYYYY and
HHMM respectively)

Many thanks,
Geoff.

Function TxtDateAdd(INDATE As Variant, INTIME As Variant,
HOURS As Double, DH As String) As Variant
TxtDateAdd = IIf(VarType(INDATE) = 8, UCase(Format
(CDate(Mid(INDATE, 1, 2) & "-" & Mid(INDATE, 3, 3) & "-" &
Mid(INDATE, 6, 4)) + CDate(Mid(INTIME, 1, 2) & ":" & Mid
(INTIME, 3, 2)) + (HOURS / 24), IIf(DH = "D", "ddmmmyyyy",
IIf(DH = "H", "hhmm", "mmhhyydd")))), "" )
End Function

 
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
user defined function tom_mcd Excel Worksheet Functions 1 January 6th 09 06:23 PM
sumproduct function / VB user defined function aw Excel Discussion (Misc queries) 3 September 23rd 08 09:05 AM
User Defined FUNCTION EAK Excel Discussion (Misc queries) 5 July 17th 08 07:07 PM
User-defined function PierreL Excel Worksheet Functions 4 December 23rd 04 09:16 AM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


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