Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default Error 1004, pasting merged cells

‘Alpha is a tab in another workbook (WBSEL) which is copied and
pasted
in to a newly added workbook (via VBA). However this is an 1004
error
relating to a merged cell (A1:J1).

For some reason it won’t copy due to the merged cell? Why is this,
the whole sheet is copied, why is it dependent on a cell?


With WBAlpha
.SaveAs Filename:="N:\mis\" & MyRange.Value & MyRange2.Value
&
"\" & "Alpha Figures" & " " & MyRange.Value & MyRange2.Value & ".xls"
End With


WBSEL.Activate
Sheets("Alpha").Select
Sheets("Alpha").Copy Befo=WBAlpha.Sheets(1)
WBAlpha.Activate
Sheets("Alpha").Paste
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet3").Select
ActiveWindow.SelectedSheets.Delete


With WBAlpha
.SendMail Recipients:=Array(RngEmailTest2.Value, RngEmailTest.Value)
.Close SaveChanges:=True


Thanks, Simon (the MyRange.Value occurances are merely a date
stamping for the previous month.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Error 1004, pasting merged cells

This line of your code copies the sheet and everything on it:

Sheets("Alpha").Copy Befo=WBAlpha.Sheets(1)

I don't see what the Paste is trying to do.

--
Jim
"Simon" wrote in message
...
‘Alpha is a tab in another workbook (WBSEL) which is copied and
pasted
in to a newly added workbook (via VBA). However this is an 1004
error
relating to a merged cell (A1:J1).

For some reason it won’t copy due to the merged cell? Why is this,
the whole sheet is copied, why is it dependent on a cell?


With WBAlpha
.SaveAs Filename:="N:\mis\" & MyRange.Value & MyRange2.Value
&
"\" & "Alpha Figures" & " " & MyRange.Value & MyRange2.Value & ".xls"
End With


WBSEL.Activate
Sheets("Alpha").Select
Sheets("Alpha").Copy Befo=WBAlpha.Sheets(1)
WBAlpha.Activate
Sheets("Alpha").Paste
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.Delete
Sheets("Sheet3").Select
ActiveWindow.SelectedSheets.Delete


With WBAlpha
..SendMail Recipients:=Array(RngEmailTest2.Value, RngEmailTest.Value)
..Close SaveChanges:=True


Thanks, Simon (the MyRange.Value occurances are merely a date
stamping for the previous month.


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
Pasting into merged cells ann Excel Discussion (Misc queries) 2 November 20th 09 06:37 PM
Runtime error '1004' Cannot change part of a merged cell [email protected] Excel Programming 0 July 11th 08 02:48 AM
Pasting into merged cells Jacques E. Bouchard Excel Discussion (Misc queries) 1 May 12th 05 03:27 AM
Excel 1004 Error When Pasting Special W/ Macro setoFairfax Excel Discussion (Misc queries) 2 April 27th 05 02:28 PM
Error 1004 when pasting - Hair pulling time Andy Excel Programming 3 September 30th 04 05:59 PM


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