Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Removing leading spaces

I am converting an Oracle report to Excel, and have run into an issue. I have
changed the macro to pull a different column than before. The data still
resides in the O column, but is different, from a trailing and leading zero
standpoint. The portion of the macro that worked befo

' Removes leading spaces column O
Columns("O:O").TextToColumns Destination:=Range("O1"), _
DataType:=xlFixedWidth, OtherChar:="|", _
FieldInfo:=Array(Array(0, 2), Array(7, 1))

the cells in this column had 6 leading, and 4 trailing spaces. Now, when I
pull a different column of data from Oracle, but put it in the same column in
Oracle, I get the "Do you want to replace the contents of the destination
cells?" question, which I did not get before. If I answer yes, it errors out
on the next step in the macro, which attempts to put the data in a pivot
table format. It won't work, because the macro has deleted the column
heading. Again, something that didn't happen before. The onle difference I
can see is that the new column I am trying to bring in has 6 preceding
spaces, no trailing, instead of the 6 leading and 4 trailing of the old
column. Evidently, I am clueless, and could use a hand....



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Removing leading spaces

JM,

If they are really spaces, and you don't have any interior spaces to worry
about, then you could use the line:

Columns("O:O").Replace What:=" ", Replacement:="", LookAt:=xlPart

Otherwise, you will need to re-record a macro that does what you need it to
do.

HTH,
Bernie
MS Excel MVP

"jmdaniel" wrote in message
...
I am converting an Oracle report to Excel, and have run into an issue. I

have
changed the macro to pull a different column than before. The data still
resides in the O column, but is different, from a trailing and leading

zero
standpoint. The portion of the macro that worked befo

' Removes leading spaces column O
Columns("O:O").TextToColumns Destination:=Range("O1"), _
DataType:=xlFixedWidth, OtherChar:="|", _
FieldInfo:=Array(Array(0, 2), Array(7, 1))

the cells in this column had 6 leading, and 4 trailing spaces. Now, when I
pull a different column of data from Oracle, but put it in the same column

in
Oracle, I get the "Do you want to replace the contents of the destination
cells?" question, which I did not get before. If I answer yes, it errors

out
on the next step in the macro, which attempts to put the data in a pivot
table format. It won't work, because the macro has deleted the column
heading. Again, something that didn't happen before. The onle difference I
can see is that the new column I am trying to bring in has 6 preceding
spaces, no trailing, instead of the 6 leading and 4 trailing of the old
column. Evidently, I am clueless, and could use a hand....





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Removing leading spaces


you might also be able to use the text to colums feature to remove th
leading spaces its under Data -- Text to colums then just eithe
delimit it with spaces (if there are no spaces in side the data) or us
the fixed width delimiting and you can get rid of the leading spaces bu
the ending spaces might not work unless your data all has the sam
lenght of character

--
clan
-----------------------------------------------------------------------
clane's Profile: http://www.excelforum.com/member.php...fo&userid=1186
View this thread: http://www.excelforum.com/showthread.php?threadid=27497

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Removing leading spaces

Genius, Bernie. Thanks for the help. Thanks to you too, Clane, for taking a
look at it.

"Bernie Deitrick" wrote:

JM,

If they are really spaces, and you don't have any interior spaces to worry
about, then you could use the line:

Columns("O:O").Replace What:=" ", Replacement:="", LookAt:=xlPart

Otherwise, you will need to re-record a macro that does what you need it to
do.

HTH,
Bernie
MS Excel MVP

"jmdaniel" wrote in message
...
I am converting an Oracle report to Excel, and have run into an issue. I

have
changed the macro to pull a different column than before. The data still
resides in the O column, but is different, from a trailing and leading

zero
standpoint. The portion of the macro that worked befo

' Removes leading spaces column O
Columns("O:O").TextToColumns Destination:=Range("O1"), _
DataType:=xlFixedWidth, OtherChar:="|", _
FieldInfo:=Array(Array(0, 2), Array(7, 1))

the cells in this column had 6 leading, and 4 trailing spaces. Now, when I
pull a different column of data from Oracle, but put it in the same column

in
Oracle, I get the "Do you want to replace the contents of the destination
cells?" question, which I did not get before. If I answer yes, it errors

out
on the next step in the macro, which attempts to put the data in a pivot
table format. It won't work, because the macro has deleted the column
heading. Again, something that didn't happen before. The onle difference I
can see is that the new column I am trying to bring in has 6 preceding
spaces, no trailing, instead of the 6 leading and 4 trailing of the old
column. Evidently, I am clueless, and could use a hand....






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
Removing Leading Spaces Kathleen Hogan Excel Discussion (Misc queries) 7 January 8th 08 11:53 PM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Trim Leading Spaces Steven Excel Worksheet Functions 6 February 21st 07 11:21 PM
Removing leading/trailing spaces Chuda Excel Discussion (Misc queries) 2 September 12th 06 04:20 PM
How do I add leading spaces to a value? Chris Brown Excel Worksheet Functions 3 March 3rd 06 05:23 PM


All times are GMT +1. The time now is 04:59 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"