Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying worksheet into another worksheet

hi guys,

I have an excel file name Product.xls which is generated from an RDL, also i
have created a Conversion Tool, which is another excel file with a macro,
which can manipulate the Products.xls to generate another report, my problem
is, in this Products.xls, there is one column named Summary which contains
more than 911 characters, when i used the Conversion Tool, it generated
another excel file, but the Summay colum contains only 255 characters.

this is a line of code from my Conversion Tool, which copy the worksheet of
Products.xls into another excel file.

Public Sub ExportDataToOutPut()
Dim ws As Worksheet, wsNew As Workbook
Dim FileName As String, I As Integer

Set wsNew = Workbooks.Add
FileName = wsNew.FullName

I = 1
For Each Worksheet In ThisWorkbook.Worksheets
Windows("Products.xls").Activate
Sheets(Worksheet.Name).Select
Sheets(Worksheet.Name).Copy Befo=Workbooks(FileName).Sheets(I)
I = I + 1
Next

please help me on how am i going to fix my problem.
your reply is highly appreciated.

thanks in advace.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copying worksheet into another worksheet

If you manually copy a sheet that has a cell that has more than 255, you'll see
a warning prompt.

In code, you don't see that prompt.

One way around it is to copy the sheet, then go back and copy|paste the cells.

I'm assuming that Product.xls is the workbook that holds the code
(ThisWorkbook).

Option Explicit
Public Sub ExportDataToOutPut()
Dim wks As Worksheet
Dim wkbkNew As Workbook

Set wkbkNew = Workbooks.Add(1) 'single sheet
wkbkNew.Worksheets(1).Name = "delete me later"

For Each wks In ThisWorkbook.Worksheets
'copy the sheet
wks.Copy _
after:=wkbkNew.Worksheets(wkbkNew.Worksheets.Count )

'copy the cells on the sheet
wks.Cells.Copy _
Destination:=wkbkNew.Worksheets _
(wkbkNew.Worksheets.Count).Range("a1")
Next wks

'clean up that first sheet
Application.DisplayAlerts = False
wkbkNew.Worksheets("delete me later").Delete
Application.DisplayAlerts = True

End Sub


ecasabuena wrote:

hi guys,

I have an excel file name Product.xls which is generated from an RDL, also i
have created a Conversion Tool, which is another excel file with a macro,
which can manipulate the Products.xls to generate another report, my problem
is, in this Products.xls, there is one column named Summary which contains
more than 911 characters, when i used the Conversion Tool, it generated
another excel file, but the Summay colum contains only 255 characters.

this is a line of code from my Conversion Tool, which copy the worksheet of
Products.xls into another excel file.

Public Sub ExportDataToOutPut()
Dim ws As Worksheet, wsNew As Workbook
Dim FileName As String, I As Integer

Set wsNew = Workbooks.Add
FileName = wsNew.FullName

I = 1
For Each Worksheet In ThisWorkbook.Worksheets
Windows("Products.xls").Activate
Sheets(Worksheet.Name).Select
Sheets(Worksheet.Name).Copy Befo=Workbooks(FileName).Sheets(I)
I = I + 1
Next

please help me on how am i going to fix my problem.
your reply is highly appreciated.

thanks in advace.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying worksheet into another worksheet

Thanks Dave, its working smoothly now.
I really appreciate it.
Thank you very much.

"Dave Peterson" wrote:

If you manually copy a sheet that has a cell that has more than 255, you'll see
a warning prompt.

In code, you don't see that prompt.

One way around it is to copy the sheet, then go back and copy|paste the cells.

I'm assuming that Product.xls is the workbook that holds the code
(ThisWorkbook).

Option Explicit
Public Sub ExportDataToOutPut()
Dim wks As Worksheet
Dim wkbkNew As Workbook

Set wkbkNew = Workbooks.Add(1) 'single sheet
wkbkNew.Worksheets(1).Name = "delete me later"

For Each wks In ThisWorkbook.Worksheets
'copy the sheet
wks.Copy _
after:=wkbkNew.Worksheets(wkbkNew.Worksheets.Count )

'copy the cells on the sheet
wks.Cells.Copy _
Destination:=wkbkNew.Worksheets _
(wkbkNew.Worksheets.Count).Range("a1")
Next wks

'clean up that first sheet
Application.DisplayAlerts = False
wkbkNew.Worksheets("delete me later").Delete
Application.DisplayAlerts = True

End Sub


ecasabuena wrote:

hi guys,

I have an excel file name Product.xls which is generated from an RDL, also i
have created a Conversion Tool, which is another excel file with a macro,
which can manipulate the Products.xls to generate another report, my problem
is, in this Products.xls, there is one column named Summary which contains
more than 911 characters, when i used the Conversion Tool, it generated
another excel file, but the Summay colum contains only 255 characters.

this is a line of code from my Conversion Tool, which copy the worksheet of
Products.xls into another excel file.

Public Sub ExportDataToOutPut()
Dim ws As Worksheet, wsNew As Workbook
Dim FileName As String, I As Integer

Set wsNew = Workbooks.Add
FileName = wsNew.FullName

I = 1
For Each Worksheet In ThisWorkbook.Worksheets
Windows("Products.xls").Activate
Sheets(Worksheet.Name).Select
Sheets(Worksheet.Name).Copy Befo=Workbooks(FileName).Sheets(I)
I = I + 1
Next

please help me on how am i going to fix my problem.
your reply is highly appreciated.

thanks in advace.


--

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
copying worksheet including graphs to new worksheet leif Excel Discussion (Misc queries) 9 March 7th 10 04:03 AM
Worksheet formula incorrect after copying to another worksheet Karen Excel Worksheet Functions 2 November 12th 09 01:06 AM
Looking up a variable in one worksheet and copying information from another column to another worksheet?? Brad Torken Excel Discussion (Misc queries) 2 December 10th 06 06:02 AM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM
Copying Worksheet triggers Click event of combobox on another worksheet Robert[_20_] Excel Programming 0 January 23rd 04 07:40 PM


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