I
itarnak
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).PasteSpecial
Paste:=xlPasteValues
DestinationSheet.Rows(destinationRowNumber).PasteSpecial
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).PasteSpecial
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
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).PasteSpecial
Paste:=xlPasteValues
DestinationSheet.Rows(destinationRowNumber).PasteSpecial
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).PasteSpecial
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