ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Error (https://www.excelbanter.com/excel-programming/321504-macro-error.html)

BDK

Macro Error
 
I'm using a macro to do a copy, paste special, transpose skip blank line and
repeat. I've used it in another worksheet and it worked fine. When I try
to use it in my current work sheet (I copied the macro to the new worksheet)
it gives me a run-time error 1004; copy area and paste area are not the same
shape and size.

If I make my selection smaller and then run the macro, it doesn't seem to
pick up on the blank lines inbetween each entry; therefore transposing my
data all onto ONE line.

Sub Blank ()
Dim myArea As Range

For Each myArea In Selection.SpecialCells(xlCellTypeConstants).Areas
myArea.Copy
Range("A25500").End(xlUp).Offset(1, 0) _
.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
transpose:=True
Next myArea

End Sub


No Name

Macro Error
 
hi,
check your code and make sure that you don't have any
absolute adresses in it.

-----Original Message-----
I'm using a macro to do a copy, paste special, transpose

skip blank line and
repeat. I've used it in another worksheet and it worked

fine. When I try
to use it in my current work sheet (I copied the macro to

the new worksheet)
it gives me a run-time error 1004; copy area and paste

area are not the same
shape and size.

If I make my selection smaller and then run the macro, it

doesn't seem to
pick up on the blank lines inbetween each entry;

therefore transposing my
data all onto ONE line.

Sub Blank ()
Dim myArea As Range

For Each myArea In Selection.SpecialCells

(xlCellTypeConstants).Areas
myArea.Copy
Range("A25500").End(xlUp).Offset(1, 0) _
.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
transpose:=True
Next myArea

End Sub

.



All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com