Results 1 to 3 of 3

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

This is a discussion on In VBA, how to strip dashes out of numbers in a variable within the Excel Questions forums, part of the Question Forums category; In my VBA code, how do you strip out dashes, convert numers to a text string, & assign it to ...

  1. #1
    Board Regular
    Join Date
    Jun 2005
    Posts
    165

    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, Moderator Von Pookie's Avatar
    Join Date
    Feb 2002
    Location
    The act or process of locating.
    Posts
    13,686

    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

    Default

    Works great!

    Thanks Kristy

    mikeburg

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