PC Review


Reply
Thread Tools Rate Thread

Another runtime 1004 error

 
 
Zilla
Guest
Posts: n/a
 
      17th Jan 2008
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 With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      17th Jan 2008
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
>

 
Reply With Quote
 
Zilla
Guest
Posts: n/a
 
      17th Jan 2008
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 <zill...@bellsouth.net> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error 1004 after 1st run Arkansas Lady Microsoft Access VBA Modules 4 24th Sep 2008 04:04 PM
Runtime error 1004 leejen87@gmail.com Microsoft Excel Programming 2 4th Apr 2007 08:02 PM
1004 runtime error =?Utf-8?B?V2FsZHlk?= Microsoft Excel Programming 1 18th Jul 2006 06:54 PM
runtime error 1004 JC Microsoft Excel Programming 3 4th Nov 2005 12:50 PM
Another runtime 1004 error Paulbill1@gmail.com Microsoft Excel Misc 2 17th Sep 2005 09:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:29 AM.