Thread
:
Add new Worksheet after filling first 256 columns
View Single Post
#
5
Posted to microsoft.public.excel.programming
m4nd4li4
external usenet poster
Posts: 13
Add new Worksheet after filling first 256 columns
Hi Steve,
Many thanks for the reply. But again it did not go to plan. I made the
changes as you said. But this time a second sheet is added but is
blank. What happens is that after the initial 256 columns are filled,
it begins at column 1 of the FIRST sheet, instead of the second sheet.
Now I am completely lost. It was obvious(!!!) you had to reset col
back to 1. But...???
Any other suggestions? I will not be beaten by this macro!!!
Regards,
Bharesh
(Steve Walton) wrote in message ...
On 4 Mar 2004 00:30:50 -0800,
(m4nd4li4)
wrote:
Hello,
Many thanks for the reply. Unfortunately there is a but!! After all
256 columns are filled on the first sheet, it does adds lots and lots
of BLANK sheets, that the number of sheets it adds is equal to the
number of text files in the directory. I wanted the second sheet to be
filled, to 256 columns, with the contents of the text files. Once all
256 columns are filled, I would like to do the same for the third
sheet, etc, etc...... Any suggestions???
Regards,
Bharesh
The code needs a tweak,
after creating a new sheet col is not reset so for 257, 258 etc
a new sheet is being added.
Change this bit of code
If col < 256 Then
col = col + 1
Else
ThisWorkbook.Sheets.Add Befo=Worksheets(1)
End If
to this
If col < 256 Then
col = col + 1
Else
ThisWorkbook.Sheets.Add Befo=Worksheets(1)
col = 1 ' reset count for next sheet
End If
Steve
Reply With Quote
m4nd4li4
View Public Profile
Find all posts by m4nd4li4