|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replacing Text in Excel Cells using .vbs
I have a script which gathers some data on some directories on a server and places this information into an Excel spreadsheet.
In one of the columns I have gathered the folder names (Folder.name). I want to shorten them by eliminating the words " Data Share" from each of the cells I have selected. I created an Excel macro, but the code does not function properly from the script: oSheet.Range("A4:A15").Select Selection.Replace What:=" Data Share", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Please help! This is driving me crazy. Please send any help via e-mail. Thank you. |
|
#2
|
|||
|
|||
|
What is the application doing that you are not expecting?
__________________
El éxito consiste en una serie de pequeñas victorias día a día MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html |
|
#3
|
|||
|
|||
|
I am trying to get the .vb script to replace some text in Excel.
I get the following message on the line Selection.Replace: Microsoft VBScript compilation error: Expected statement Last edited by isd503 : January 14th, 2004 at 10:53 AM. |
|
#4
|
|||
|
|||
|
I figured it out by reviewing another post elsewhere. Just wanted to share:
Set myRange = oSheet.Range("A4:A15") myRange.Replace " Data Share", "", 2, 1, 0 The preceding code replaces <space>Data<space>Share with nothing. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Replacing Text in Excel Cells using .vbs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|