LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
DMB
 
Posts: n/a
Default Is there a quicker way to copy a rang abd its formatting this is 2

I need to make several copies of 64 rows from sheet 1 to sheet 2 including
the formatting. the copy, rowheight, and the columnwidth functions are
extremely slow. How would you do this with a collection object, or better yet
through the Excel database?

Sub experiment()
Dim NumberOfLines As Integer
NumberOfLines = 3
Dim ExistingSheet As Worksheet
Dim NewSheet As Worksheet
Set ExistingSheet = ThisWorkbook.Sheets("2")
Set NewSheet = ThisWorkbook.Sheets("NewSheet")

Dim i As Integer
Dim j As Integer
Dim LineCount As Integer
For LineCount = 1 To NumberOfLines
For i = 1 To 64
For j = 1 To 13
Worksheets("2").Cells(i + 10, j).Copy
Destination:=Worksheets("NewSheet").Cells(i + 10 + (LineCount - 1) * 66, j)
Worksheets("2").Cells(i + 10, j).ColumnWidth =
Worksheets("NewSheet").Cells(i + 10 + (LineCount - 1) * 66, j).ColumnWidth
Next j
Worksheets("2").Cells(i + 10, j).RowHeight =
Worksheets("NewSheet").Cells(i + 10 + (LineCount - 1) * 66, j).RowHeight
Next i
Next LineCount

End Sub
 
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
How can I copy the formatted value and paste as a new value(not the original value with formatting)? Daniel Excel Discussion (Misc queries) 2 May 7th 23 11:42 AM
Can I copy the formatting of a cell in a IF Fucntion "VLOOKUP"? Terry Excel Worksheet Functions 1 October 26th 05 06:49 PM
How do I copy text formatting using a formula? topsquark Excel Discussion (Misc queries) 2 October 11th 05 02:41 PM
Copy paste Conditional Formatting Bud Hughes Excel Discussion (Misc queries) 3 October 1st 05 11:28 PM
Excel won't copy outside sheet Jack Sons Excel Discussion (Misc queries) 6 May 17th 05 10:05 PM


All times are GMT +1. The time now is 05:15 AM.

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"