Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace characters in columns in excel


I need some help in replacing carriage returns that is occuring in the
excel file using vbscript.

Anyone to guide me?

Thanks


--
moonwalker
------------------------------------------------------------------------
moonwalker's Profile: http://www.excelforum.com/member.php...o&userid=31766
View this thread: http://www.excelforum.com/showthread...hreadid=516190

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Replace characters in columns in excel

Give something like this a try:

Sub remove10()
Dim Rng, r As Range
'removes carriage returns from A1 down
Set Rng = Range(Cells(1, 1), _
Cells(ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row, 1))
For Each r In Rng
r.Value = Application.Substitute(Trim(CStr(r.Value)), Chr(10), "")
Next r
End Sub

HTH--Lonnie M.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace characters in columns in excel


sorry for the inconvience

im writing in vbscript and im rather a newbie

Set objXL = WScript.CreateObject ("Excel.Application")
Set objWb = objXl.WorkBooks.Open(GetPath+file)

I have objXL and objWB open..
so how i can make use of ur code snippet to remove the carriage return
in the worksheet?

Thanks a lot


--
moonwalker
------------------------------------------------------------------------
moonwalker's Profile: http://www.excelforum.com/member.php...o&userid=31766
View this thread: http://www.excelforum.com/showthread...hreadid=516190

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace characters in columns in excel


is there any help

--
moonwalke
-----------------------------------------------------------------------
moonwalker's Profile: http://www.excelforum.com/member.php...fo&userid=3176
View this thread: http://www.excelforum.com/showthread.php?threadid=51619

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace characters in columns in excel


set objRange = objXL.Range("A1:I56")
objRange.Select
objRange.Replace Chr(10), ""


i have manage to come out with something like this it replaces the
carriage return with empty string..


another question,
how can i select all the range in the worksheet if there are fields in
it?


--
moonwalker
------------------------------------------------------------------------
moonwalker's Profile: http://www.excelforum.com/member.php...o&userid=31766
View this thread: http://www.excelforum.com/showthread...hreadid=516190



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Replace characters in columns in excel

Hi Moonwalker,

Try:

Set ObjRng = Activesheet.UsedRange


---
Regards,
Norman



"moonwalker" wrote
in message ...

set objRange = objXL.Range("A1:I56")
objRange.Select
objRange.Replace Chr(10), ""


i have manage to come out with something like this it replaces the
carriage return with empty string..


another question,
how can i select all the range in the worksheet if there are fields in
it?


--
moonwalker
------------------------------------------------------------------------
moonwalker's Profile:
http://www.excelforum.com/member.php...o&userid=31766
View this thread: http://www.excelforum.com/showthread...hreadid=516190



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Replace characters in columns in excel

dim objWks as object
set objwks = objWB.worksheets(1)
set objRange = objwks.usedrange
'or set objRange = objwks.Cells
'you don't need to select it.
objRange.Replace Chr(10), ""

====
I'm not sure what "if there are fields in it" means???


moonwalker wrote:

set objRange = objXL.Range("A1:I56")
objRange.Select
objRange.Replace Chr(10), ""

i have manage to come out with something like this it replaces the
carriage return with empty string..

another question,
how can i select all the range in the worksheet if there are fields in
it?

--
moonwalker
------------------------------------------------------------------------
moonwalker's Profile: http://www.excelforum.com/member.php...o&userid=31766
View this thread: http://www.excelforum.com/showthread...hreadid=516190


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace many asterisk characters, '*' in Excel -G. Excel Discussion (Misc queries) 4 October 31st 06 01:16 PM
How to find and replace in Excel for special characters? Jill Excel Discussion (Misc queries) 1 May 25th 06 04:29 PM
How do I search and replace special characters in Excel e.g. „¢ David Harrison Excel Discussion (Misc queries) 1 May 10th 06 07:10 PM
How do you find and replace tab characters in a cell in Excel? Ryk Excel Discussion (Misc queries) 1 March 28th 06 09:36 PM
How can I replace 2 of 5 characters within an cell in MS Excel? pmhall Excel Worksheet Functions 8 June 8th 05 09:07 PM


All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"