1 Replies - 776 Views - Last Post: 11 February 2010 - 10:44 AM Rate Topic: -----

#1 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 805
  • Joined: 16-September 09

Retrieving (val) of ascii code for dob macro

Posted 10 February 2010 - 03:01 PM

I'm formatting a DOB column in a file I have. The problem is I have to do it based on length of cell. Everything works except this one piece and I was wondering if someone could tell me what I'm doing wrong.

Sub test()

sDOBTotal = ActiveCell.Value
sDOBCheck1 = Mid(sDOBTotal, 2, 1)
'Chr(47) = "/"
                        If (Val(sDOBCheck)) = Chr(47) Then
                            MsgBox "Success"
                            'sDOBM = Left(sDOBTotal, 1)
                            'sDOBD = Mid(sDOBTotal, 3, 2)
                            'sDOBYr = Right(sDOBTotal, 2)
                            'sDOBYr = "19" & sDOBYr
                            'sDOBTotal = sDOBM & "/" & sDOBD & "/" & sDOBYr
                            'ActiveCell.Value = sDOBTotal
                        Else
                            MsgBox "Not Recognized"
                        End If

End Sub



I also tried this to see what value it was getting and the value returned as 0 on this Date 4/20/2030
msgbox val(sDOBCheck)



if anyone could explain what I'm doing wrong, I would really appreciate it

Is This A Good Question/Topic? 0
  • +

Replies To: Retrieving (val) of ascii code for dob macro

#2 guyfromri  Icon User is offline

  • D.I.C Addict

Reputation: 46
  • View blog
  • Posts: 805
  • Joined: 16-September 09

Re: Retrieving (val) of ascii code for dob macro

Posted 11 February 2010 - 10:44 AM

To follow up, I answered my own question...

val() is meant to retreive numeric values. nnow I use the name of the string with no extra characters..

ie
msgbox strdobyr



This displays the character that I want to see...just so we all know.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1