Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default .TextFileFixedColumnWidths (from Ron de Bruin)

I stumbled across a great tool on this website (that was linked to Ron de
Bruin) for copying multiple text files into one Excel workbook. This could be
extremely useful to me. However, I'm stumped on altering the code for
assigning the column widths. Below is the code that was posted on his site.
With the instruction, it seems that the width can be set for each column.
When I open a single txt file I set the following column breaks: 4, 17, 36,
56, 76, 93, 104, 117, 130. However, I cannot get it to working with this
code. Please help!! Thanks!!

'Set the width for each column
..TextFileFixedColumnWidths = Array(5, 4, 8)

On a side note, I was able to write a different macro that opened and
formatted each txt file (about 40 of them), but the macro says it's too long
and cannot run. So, I had to break it down into two separate macros. I'm
hoping I can use the above method to get around using two macros.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default .TextFileFixedColumnWidths (from Ron de Bruin)

Okay, with some additional trial and error, I was able to get this to work
with the following code:

..TextFileFixedColumnWidths = Array(4, 0, 13, 23, 18, 25, 12, 10, 12)

Only problem now is the trailing minus sign for negative numbers. There's
the option through the wizard to check this option, but I don't know the code
for including it in the Ron de Bruin macro. Anyone run into this yet? Thanks
in advance.

"Corey" wrote:

I stumbled across a great tool on this website (that was linked to Ron de
Bruin) for copying multiple text files into one Excel workbook. This could be
extremely useful to me. However, I'm stumped on altering the code for
assigning the column widths. Below is the code that was posted on his site.
With the instruction, it seems that the width can be set for each column.
When I open a single txt file I set the following column breaks: 4, 17, 36,
56, 76, 93, 104, 117, 130. However, I cannot get it to working with this
code. Please help!! Thanks!!

'Set the width for each column
.TextFileFixedColumnWidths = Array(5, 4, 8)

On a side note, I was able to write a different macro that opened and
formatted each txt file (about 40 of them), but the macro says it's too long
and cannot run. So, I had to break it down into two separate macros. I'm
hoping I can use the above method to get around using two macros.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default .TextFileFixedColumnWidths (from Ron de Bruin)

Nobody's responded yet, so I hope I haven't wasted anyones time...I figured
out my problem by adding the following code:

..TextFileTrailingMinusNumbers = True

However, I'm now stuck on something I didn't think would initially be a
problem. The txt files generated each month have the exact same name except
for the last 4 digits. How can I get the tab name to only be the first 8
digits (from the left) of the file name?

"Corey" wrote:

Okay, with some additional trial and error, I was able to get this to work
with the following code:

.TextFileFixedColumnWidths = Array(4, 0, 13, 23, 18, 25, 12, 10, 12)

Only problem now is the trailing minus sign for negative numbers. There's
the option through the wizard to check this option, but I don't know the code
for including it in the Ron de Bruin macro. Anyone run into this yet? Thanks
in advance.

"Corey" wrote:

I stumbled across a great tool on this website (that was linked to Ron de
Bruin) for copying multiple text files into one Excel workbook. This could be
extremely useful to me. However, I'm stumped on altering the code for
assigning the column widths. Below is the code that was posted on his site.
With the instruction, it seems that the width can be set for each column.
When I open a single txt file I set the following column breaks: 4, 17, 36,
56, 76, 93, 104, 117, 130. However, I cannot get it to working with this
code. Please help!! Thanks!!

'Set the width for each column
.TextFileFixedColumnWidths = Array(5, 4, 8)

On a side note, I was able to write a different macro that opened and
formatted each txt file (about 40 of them), but the macro says it's too long
and cannot run. So, I had to break it down into two separate macros. I'm
hoping I can use the above method to get around using two macros.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default .TextFileFixedColumnWidths (from Ron de Bruin)

Corey

Adjust to suit.

Sub ChangeSign()
Dim Cell As Range
On Error Resume Next
For Each Cell In Selection. _
SpecialCells(xlConstants, xlTextValues)
If Right(Trim(Cell.Value), 1) = "-" Then
Cell.Value = CDbl(Cell.Value)
End If
Next
On Error GoTo 0
End Sub


Gord Dibben MS Excel MVP

On Wed, 28 Nov 2007 10:15:02 -0800, Corey
wrote:

Okay, with some additional trial and error, I was able to get this to work
with the following code:

.TextFileFixedColumnWidths = Array(4, 0, 13, 23, 18, 25, 12, 10, 12)

Only problem now is the trailing minus sign for negative numbers. There's
the option through the wizard to check this option, but I don't know the code
for including it in the Ron de Bruin macro. Anyone run into this yet? Thanks
in advance.

"Corey" wrote:

I stumbled across a great tool on this website (that was linked to Ron de
Bruin) for copying multiple text files into one Excel workbook. This could be
extremely useful to me. However, I'm stumped on altering the code for
assigning the column widths. Below is the code that was posted on his site.
With the instruction, it seems that the width can be set for each column.
When I open a single txt file I set the following column breaks: 4, 17, 36,
56, 76, 93, 104, 117, 130. However, I cannot get it to working with this
code. Please help!! Thanks!!

'Set the width for each column
.TextFileFixedColumnWidths = Array(5, 4, 8)

On a side note, I was able to write a different macro that opened and
formatted each txt file (about 40 of them), but the macro says it's too long
and cannot run. So, I had to break it down into two separate macros. I'm
hoping I can use the above method to get around using two macros.


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
question for Ron de Bruin on importing JohnE Excel Discussion (Misc queries) 2 August 23rd 07 01:52 AM
[email protected] Ron de Bruin Excel Discussion (Misc queries) 1 July 21st 05 01:07 PM
For Ron Bruin Please Steved Excel Worksheet Functions 6 April 6th 05 02:19 AM
For Ron de Bruin Please Steved Excel Worksheet Functions 6 March 16th 05 12:46 AM
Ron de Bruin Copy2 Macro - troubleshooting gizmo Excel Worksheet Functions 3 January 18th 05 02:47 PM


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

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

About Us

"It's about Microsoft Excel"