Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a 'user' workbook to which users can add notes and highlights.
Each day, they update their 'user' workbook (target) against the updated data workbook (source). I use a separate 'Comments' sheet to copy the project numbers and user notes from the 'user' workbook and also bring in the updated data from the source workbook. There's basically a vlookup to find the matching project numbers and copy/paste the user notes comments and the user's highlighting. In this way, the users are able to maintain their notes and highlighting, while at the same time bringing in the newly updated project numbers and information. It does what it's supposed to do, but for some reason, the copy/paste formats have suddenly become VERY slow. In a nutshell, I'm trying to copy/paste values and formats of two separate columns in one sheet to another sheet. I've tried two separate ways, but no matter what, the pasting of formats takes FOREVER! The first scenario theoretically should be the fastest (Copy Destination). And it IS FAST for values, but not formats. The second scenario of copy/pastespecial yields the same results. Any thoughts? I appreciate any feedback and suggestions. Thanks. With wksTarget LastRowTgt = .Cells(.Rows.Count, "A").End(xlUp).Row ' Copies project numbers in column B to the Comments sheet. Takes less than 1 second to execute. .Range("B1:B" & LastRowTgt).Copy Destination:=wksComments.Cells(1, 1) ' Copies the user notes in column I for the respective project numbers to the comments sheet. Takes approximately 5 minutes to execute. .Range("I1:I" & LastRowTgt).Copy Destination:=wksComments.Cells(1, 5) End With I also tried this: With wksTarget LastRowTgt = .Cells(.Rows.Count, "A").End(xlUp).Row .Range("B1:B" & LastRowTgt).Copy Destination:=wksComments.Cells(1, 1) 'FAST! .Range("I1:I" & LastRowTgt).Copy wksComments.Range("E1").PasteSpecial Paste:=xlPasteValues 'FAST!! wksComments.Range("E1").PasteSpecial Paste:=xlPasteFormats 'SLOOOOOW!!! End With And ultimately, all formatting gets merged on the one wksComments sheet. With wksComments LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .Range("G2:G" & LastRow).Formula = "=IFERROR(VLOOKUP(RC6,R2C1:R56000C5, 2, FALSE)&"""","""")" .Range("H2:H" & LastRow).Formula = "=IFERROR(VLOOKUP(RC6,R2C1:R56000C5, 3, FALSE)&"""","""")" .Range("I2:I" & LastRow).Formula = "=IFERROR(VLOOKUP(RC6,R2C1:R56000C5, 4, FALSE)&"""","""")" Columns("I:I").NumberFormat = "m/d/yyyy" .Range("J2:J" & LastRow).Formula = "=IFERROR(VLOOKUP(RC6,R2C1:R56000C5, 5, FALSE)&"""","""")" ' Copies the formats for user notes in column E to column J .Range("E2:E" & LastRow).Copy .Range("J2:J" & LastRow).PasteSpecial (xlPasteFormats) 'This is VERY VERY SLOW! About 5 minutes to complete 2200 rows. End With Note: there is a project number in every cell for column B (up to about 2500). There is not a user note for every project note. But, the cell (actually the row on the Target sheet) may be highlighted. The same highlighting that is in column B is in column E (because the whole row on the Target sheet is highlighted). Why would the user notes column take SO much longer? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I copy borders without erasing other destination formats? | Excel Discussion (Misc queries) | |||
PasteSpecial: values and formats possible in vbs? | Excel Programming | |||
How to use Object.Copy(Destination) method PasteSpecial(xlPasteVal | Excel Programming | |||
.Copy Destination:= .PasteSpecial ??? | Excel Programming | |||
Copy Number Formats | Excel Programming |