![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
I want to be able to replace all occurences of "/" with "-" in VBA.
how do i do that? what function should i use? i could use instr() to search, and then manually replace that. was wondering if there is a better way of doing that. tks folks for ur help |
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
Code:
Do While InStr(MyString, "/") Mid(MyString, InStr(MyString, "/"), 1) = "-" Loop Russell |
|
|
|
|
|
|
#3 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
How's this (an example):
MsgBox WorksheetFunction.Substitute("2/12/2002", "/", "-") Cheers, Nate [ This Message was edited by: NateO on 2002-02-21 10:36 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|