Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replace many asterisk characters, '*' in Excel | Excel Discussion (Misc queries) | |||
How to find and replace in Excel for special characters? | Excel Discussion (Misc queries) | |||
How do I search and replace special characters in Excel e.g. „¢ | Excel Discussion (Misc queries) | |||
How do you find and replace tab characters in a cell in Excel? | Excel Discussion (Misc queries) | |||
How can I replace 2 of 5 characters within an cell in MS Excel? | Excel Worksheet Functions |