Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Another runtime 1004 error

I get error 1004 "Unable to get the pastespecial property of the range
class". Thanks again!

' Generic subroutine to transpose a range of cells
' from source to destination
' *** WARNING ***
' This should be used when ranges match, i.e, source and
' destination ranges have the same number of cells
Sub copyRange(sRange As Range, dRange As Range)
If (sRange.Cells.Count = dRange.Cells.Count) Then
sRange.Copy dRange.PasteSpecial(Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=True)
Application.CutCopyMode = False
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Another runtime 1004 error

Try this...

Sub copyRange(sRange As Range, dRange As Range)
If (sRange.Cells.Count = dRange.Cells.Count) Then
sRange.Copy
dRange.PasteSpecial(Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=True)
Application.CutCopyMode = False
End If
End Sub
--
HTH...

Jim Thomlinson


"Zilla" wrote:

I get error 1004 "Unable to get the pastespecial property of the range
class". Thanks again!

' Generic subroutine to transpose a range of cells
' from source to destination
' *** WARNING ***
' This should be used when ranges match, i.e, source and
' destination ranges have the same number of cells
Sub copyRange(sRange As Range, dRange As Range)
If (sRange.Cells.Count = dRange.Cells.Count) Then
sRange.Copy dRange.PasteSpecial(Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=True)
Application.CutCopyMode = False
End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Another runtime 1004 error

Ah, syntax error. I did this and it worked!
Range.Copy
dRange.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, _
SkipBlanks:=True, _
Transpose:=True)


On Jan 17, 11:42*am, Zilla wrote:
I get error 1004 "Unable to get the pastespecial property of the range
class". Thanks again!

' Generic subroutine to transpose a range of cells
' from source to destination
' *** WARNING ***
' This should be used when ranges match, i.e, source and
' destination ranges have the same number of cells
Sub copyRange(sRange As Range, dRange As Range)
* * If (sRange.Cells.Count = dRange.Cells.Count) Then
* * * * sRange.Copy dRange.PasteSpecial(Paste:=xlAll, _
* * * * * * * * * * * * * * * * * * * * Operation:=xlNone, _
* * * * * * * * * * * * * * * * * * * * SkipBlanks:=True, _
* * * * * * * * * * * * * * * * * * * * Transpose:=True)
* * * * Application.CutCopyMode = False
* * End If
End Sub


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
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
What causes runtime error 1004? [email protected] Excel Discussion (Misc queries) 4 October 27th 05 07:15 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Runtime error 1004 edreczk Excel Programming 1 November 4th 04 10:19 PM


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