Consulting

Results 1 to 4 of 4

Thread: vba for replacing the charater in cell

  1. #1
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location

    vba for replacing the charater in cell

    What is the code to replace charaters in cell



    In my range A1 is 2017/8/9


    I want to replace the string 2017/8/9 to 2017.8.9 in vba

    and then save 2017.8.9 as the file name.

    How to do so? Thank you very much!

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Are you sure it is a string and not a date? In A1, press Ctrl+1 to see the format. If a date, you can keep the date and just change the format or actually create a string. I recommend saving it as a date and formatting to suit.

  3. #3
    VBAX Contributor
    Joined
    Nov 2009
    Posts
    114
    Location
    I just want to know the code for replace "/" by "." in a cell .
    Thanks

  4. #4
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Worksheets("Sheet1").Range("A1").Value = Replace(Worksheets("Sheet1").Range("A1").Value, "/", ".")[/VBA]

Posting Permissions

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