In VBA, how to strip dashes out of numbers in a variable

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: In VBA, how to strip dashes out of numbers in a variable

  1. #1
    Board Regular
    Join Date
    Jun 2005
    Posts
    165
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default In VBA, how to strip dashes out of numbers in a variable

     
    In my VBA code, how do you strip out dashes, convert numers to a text string, & assign it to a variable from the following?

    monthendate=6-30-05

    monthendname=monthendate (need the monthendname to be 63005)

    Thank so very much.

    mikeburg

  2. #2
    MrExcel MVP Von Pookie's Avatar
    Join Date
    Feb 2002
    Location
    The act or process of locating.
    Posts
    13,686
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm not exactly sure what you're doing, but this works for me:

    Sub test()
    Dim monthenddate As String, monthendname As String

    monthenddate = "6-30-05"

    monthendname = Replace(monthenddate, "-", "")

    MsgBox monthendname

    End Sub
    Kristy

  3. #3
    Board Regular
    Join Date
    Jun 2005
    Posts
    165
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Works great!

    Thanks Kristy

    mikeburg

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com