Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PasteSpecial xlPasteFormats ends macro


On Excel Office 2000 SP3 / VBA 6.0 :

Here is the problem:

1. Initial problem

I want to copy rows (values+formats) from a sheet to another sheet,
in the same workbook.
I make a loop, to choose rows (no all rows are ok, i test some cells
values). It does something like that:


in a loop (for):

SourceSheet.Rows(sourceRowNumber).Copy
DestinationSheet.Rows(destinationRowNumber).PasteS pecial
Paste:=xlPasteValues
DestinationSheet.Rows(destinationRowNumber).PasteS pecial
Paste:=xlPasteFormats


Results:

Only the first line is copied (values+formats), the macro ends after
the first xlPasteFormats paste procedure call, and it waits for the
user to manualy select a destination cells, and when i do it, and
strike enter, it copies again values of this line..
What does that mean??


2. Second test:

I delete the line
"DestinationSheet.Rows(destinationRowNumber).Paste Special
Paste:=xlPasteFormats" from the above loop.

Results: it works fine, the whole macro is executed, i have all
values ...but i have no formats...


3. Third test:

Instead of making a loop, i copy the whole sheet (values+formats):

SourceSheet.UsedRange.Copy
DestinationSheet.Range("A1").PasteSpecial Paste:=xlPasteValues
DestinationSheet.Range("A1").PasteSpecial Paste:=xlPasteFormats

...

MsgBox "After copy..."

...

Results: same as 1. : the macro ends after the xlPasteFormats paste
procedure call, MsgBox are never executed: all values and formats are
copied, but it waits for the user to select a destination cell and when
done copies again the whole sheet ....



So what does that mean?

iTarnak


--
itarnak
------------------------------------------------------------------------
itarnak's Profile: http://www.excelforum.com/member.php...o&userid=27865
View this thread: http://www.excelforum.com/showthread...hreadid=473725

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PasteSpecial xlPasteFormats ends macro


Without the "Paste" procedure call with xlPasteValues (only
xlPasteFormats):

1. The formats are copied
2. Excel waits for user action: i select manually destination cell,
strike enter, and then the values are copied too....and the macro ends
immediatly...


I don't understand that....


Regards,

iTarnak


--
itarnak
------------------------------------------------------------------------
itarnak's Profile: http://www.excelforum.com/member.php...o&userid=27865
View this thread: http://www.excelforum.com/showthread...hreadid=473725

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default PasteSpecial xlPasteFormats ends macro

I don't understand that....

Nor do I. There is no way a paste special of formats should make a macro
pause and wait for user input. Have you tried running this code (or a
simplified version of it) in a new workbook? If it runs as it should the
problem workbook might have "gone bad", i.e., have some kind of corruption.
That sounds lame but I've seen workbooks start doing weirder things than
this for no apparent reason.

--
Jim
"itarnak" wrote in
message ...
|
| Without the "Paste" procedure call with xlPasteValues (only
| xlPasteFormats):
|
| 1. The formats are copied
| 2. Excel waits for user action: i select manually destination cell,
| strike enter, and then the values are copied too....and the macro ends
| immediatly...
|
|
| I don't understand that....
|
|
| Regards,
|
| iTarnak
|
|
| --
| itarnak
| ------------------------------------------------------------------------
| itarnak's Profile:
http://www.excelforum.com/member.php...o&userid=27865
| View this thread: http://www.excelforum.com/showthread...hreadid=473725
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PasteSpecial xlPasteFormats ends macro


I have just discovered that if i manually copy a row in that sourc
sheet and paste it elsewhere, once pasted, excel asked me again t
select destination cell and strike enter.......and when i do it i
pastes again the row.....

What is this strange behaviour??

Regards,

iTarna

--
itarna
-----------------------------------------------------------------------
itarnak's Profile: http://www.excelforum.com/member.php...fo&userid=2786
View this thread: http://www.excelforum.com/showthread.php?threadid=47372

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default PasteSpecial xlPasteFormats ends macro


The pb was due to a date which were in a bad format (not a format date)
and there were an format condition on this column. The conditiona
format called a macro to calculate difference between dates. As ther
were a bad date in one cell, instead of showing error when callin
xlPasteFormats , excel did nothing, waiting for user action (manual
paste) since it just called the copy function before.

Thats all..

--
itarna
-----------------------------------------------------------------------
itarnak's Profile: http://www.excelforum.com/member.php...fo&userid=2786
View this thread: http://www.excelforum.com/showthread.php?threadid=47372



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
filter using "ends with" and 3 choices? Ex: ends with 1,2 or3 Debbie Excel Worksheet Functions 1 April 6th 07 12:07 AM
Export as HTML Macro and other odds and ends Danimagus[_3_] Excel Programming 0 June 3rd 05 05:15 PM
Range Name Duplication and PasteSpecial Macro Mike Wrob Excel Programming 3 January 10th 05 04:32 PM
Loop never ends Bernie Deitrick Excel Programming 0 June 30th 04 07:00 PM
PasteSpecial macro CG Rosén Excel Programming 3 December 22nd 03 01:14 AM


All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"