Results 1 to 14 of 14

Macro for prompting date entry

Threaded View

  1. #1
    Registered User
    Join Date
    09-08-2011
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    20

    Macro for prompting date entry

    Hi all, I need to create a condition in which a input prompt pops up for date entry.

    I have two problems currently present in my spreadsheet. The first one is that i need to have the message of the equation
    =IF(AND(F10="Pending",M1="Pending"), "Please Enter Date", "")
    displayed in the cell upon fulfilling the condition followed by the prompting of entry of the date.

    The second problem I currently face is that I can't seem to get the date format to display in the input box as it only displays numbers.

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
         
        Dim Rng1            As Range
        Dim Prompt          As String
        Dim Title           As String
        Dim Date1       As Long
        
         
        Set Rng1 = Me.Range("A1:A50")
        If Intersect(Target(1, 1), Rng1) Is Nothing Then
            Exit Sub
        End If
        Cancel = True
        On Error Resume Next
        Prompt = "Enter date formatted: mm/dd/yyyy"
        Title = "[Please Enter Date]"
        Date1 = InputBox(Prompt, Title)
         
        
         
        If Err <> 0 Then
            On Error GoTo 0
            Exit Sub
        End If
        On Error GoTo 0
         
        Target(1, 1).NumberFormat = "@"
        Target(1, 1).Value = Date1 & ""
         
    End Sub
    If anyone could provide some help to where I went wrong, that would be greatly appreciated.
    Last edited by Armored Wing; 01-17-2012 at 10:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1