LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default range value with variable not working?

True, pasting to a range is one form of PasteSpecial. But that is a range:

From the immediate window.
i = 1
? typename(Sheets("ReportOutput").Cells((i + 3), 6))
Range
? Sheets("ReportOutput").Cells((i + 3), 6).Address
$F$4

This ran fine for me:

Sub AAA()
NumRows = 10
Sheets("ReportOutput").Range("F4").Copy
For i = 1 To NumRows
Sheets("ReportOutput").Cells((i + 3), 6).PasteSpecial xlPasteFormulas
Next i

End Sub

Of course Bernie is correct that you don't need to loop.

--
Regards,
Tom Ogilvy



"James" wrote in message
...

"Tom Ogilvy" wrote in message
...
Change Range to Cells

Sheets("ReportOutput").Range("F4").Copy
For i = 1 To NumRows
Sheets("ReportOutput").Cells((i + 3), 6).PasteSpecial

xlPasteFormulas
Next i


Thanks,
I then get error 1004, PasteSpecial of Range class failed.


I think becuase the pastespecial method can only be applied to a range?




 
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
Variable Range for NPV Dkline Excel Worksheet Functions 7 August 27th 08 02:14 PM
Variable not working Phil Excel Discussion (Misc queries) 2 April 11th 07 11:49 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
variable range: l just can't get there! ste mac Excel Programming 2 October 27th 03 06:43 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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