Hi,
Moving from Excel 2007 on Windows XP to Excel 2010 on Windows 7, I am experiencing an issue with the following code – It just stalls at the paste formats line and refuses to continue….
'Update Reconciliation
wb1.Sheets("V+ Reports").Cells.Copy
wb0.Sheets("V+ Reports").Range("A1").PasteSpecial Paste:=xlPasteValues
wb0.Sheets("V+ Reports").Range("A1").PasteSpecial Paste:=xlPasteFormats
I have tried adjusting to the following in the hope activation / sheet selection might help, but no difference.
'Update Reconciliation
wb1.Sheets("V+ Reports").Cells.Copy
wb0.Activate
wb0.Sheets("V+ Reports").Select
wb0.Sheets("V+ Reports").Range("A1").PasteSpecial Paste:=xlPasteValues
wb0.Sheets("V+ Reports").Range("A1").PasteSpecial Paste:=xlPasteFormats
Any idea’s please?
Macro change from 2007 to 2010
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Macro change from 2007 to 2010
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Macro change from 2007 to 2010
It shouldn't be necessary to activate the workbook and to select the sheet.
Is wb1 a .xls workbook and wb0 a .xlsx/.xlsb/.xlsm workbook, or vice versa?
Is wb1 a .xls workbook and wb0 a .xlsx/.xlsb/.xlsm workbook, or vice versa?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Macro change from 2007 to 2010
Hi Hans, thought that myself but felt worth a try.... Both are xlsm.
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Macro change from 2007 to 2010
Does it work better if you change
wb1.Sheets("V+ Reports").Cells.Copy
to
wb1.Sheets("V+ Reports").UsedRange.Copy
wb1.Sheets("V+ Reports").Cells.Copy
to
wb1.Sheets("V+ Reports").UsedRange.Copy
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Macro change from 2007 to 2010
There must be something else going on that has nothing to do with Excel 2007/2010. Has either of the worksheets involved been changed in another way - merging cells, or something like that?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: Macro change from 2007 to 2010
No. I bypassed the line and had the same issue with the next set of sheets.
So i switched back to 2007 win XP and it worked fine.
Does not make any sense : (
So i switched back to 2007 win XP and it worked fine.
Does not make any sense : (
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Macro change from 2007 to 2010
I don't understand it either. The changes from Excel 2007 to Excel 2010 aren't large...VegasNath wrote:Does not make any sense : (
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Macro change from 2007 to 2010
I too am baffled at why this code is freezing?
how about another approach?
how about another approach?
Code: Select all
wb1.Sheets("V+ Reports").Copy Before:=wb0.Sheets(1)
wb0.Sheets(1).UsedRange.Value = wb0.Sheets(1).UsedRange.Value
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.