LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Macro lagging when copying columns to other sheet

This segment of codes lags terribly, and I'm not sure why. When I
Break then Continue the code, it speeds up again. Is there any way I
can tidy up the following code to make it more efficient?

'* Create destination Workbook and move data to it
DestRptCols = Array("Trans Type", "Trans ID", "Event ID",
"Location ID", "Constit ID", _
"Constit Type", "First Name", "Last Name",
"Eng/Fr", "Address Line1", _
"City", "Prov", "Postal Code", "Country",
"Home Email", "Email Y/N", _
"Registration Fee", "Registration Fee
Amount", "Donation Date", _
"Donation Amount", "Tax Receipt Number",
"Tax Receipt Amount", _
"Payment Method", "CC Transaction ID", "CC
Type", "CC Holder Name")

Set DestBk = Workbooks.Add
DestCols = 0
SrcLast = LastRow(SrcWS)

For Each Thing In DestRptCols
SourceBk.Activate
Set MyCell = Cells.Find(Thing, After:=ActiveCell,
LookIn:=xlFormulas, _
Lookat:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext,
MatchCase:=False).Columns
Range(MyCell.Address & ":" & MyCell.Offset(SrcLast,
0).Address).Copy

DestCols = DestCols + 1

With DestBk.Sheets(1).Columns(DestCols)
.PasteSpecial Paste:=8
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With

Next
 
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
Issue removing leading and lagging spaces robs3131 Excel Programming 10 February 14th 08 02:43 PM
Copying sheet with hidden columns Jock Excel Programming 4 August 22nd 07 09:14 PM
2 questions, copying data from sheet to sheet and assigning macro Boris Excel Worksheet Functions 0 December 16th 04 06:11 PM
Copying the entire sheet if columns H & G are equal to row. ICSAnalyst[_2_] Excel Programming 0 November 12th 04 10:21 PM
Copying rows with spesified data on one or more columns from sheet/file to another? Zemalf Excel Programming 0 October 15th 04 07:55 AM


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