Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Error on sh.Paste sh.Range = ("A1")


First one works (Macro 2000)
Second one (same code) doesn't. Error on
Sh.Paste sh.Range = ("A1").


Sub Macro2000()
'
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("38:50").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next
Application.CutCopyMode = False
End Sub

Sub Macro1000()
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("1:15").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range = ("A1")
End If
Next
Application.CutCopyMode = False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Error on sh.Paste sh.Range = ("A1")


Sh.Range("A1").Paste

"J.W. Aldridge" wrote in message
...

First one works (Macro 2000)
Second one (same code) doesn't. Error on
Sh.Paste sh.Range = ("A1").


Sub Macro2000()
'
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("38:50").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next
Application.CutCopyMode = False
End Sub

Sub Macro1000()
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("1:15").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range = ("A1")
End If
Next
Application.CutCopyMode = False
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default Error on sh.Paste sh.Range = ("A1")

Error.... object doesnt support this property or method

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Error on sh.Paste sh.Range = ("A1")


try
Sh.Range("A1").PasteSpecial xlAll


"Patrick Molloy" wrote in message
...
Sh.Range("A1").Paste

"J.W. Aldridge" wrote in message
...

First one works (Macro 2000)
Second one (same code) doesn't. Error on
Sh.Paste sh.Range = ("A1").


Sub Macro2000()
'
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("38:50").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next
Application.CutCopyMode = False
End Sub

Sub Macro1000()
Dim sh As Worksheet
'copy range from template sheet
Sheets("Ind Templates").Rows("1:15").Copy
'for each sheet in workbook after "ind templates"
x = Sheets("Ind Templates").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
'paste the copied data 1row below the last row used
sh.Paste sh.Range = ("A1")
End If
Next
Application.CutCopyMode = False
End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Error on sh.Paste sh.Range = ("A1")


Hi Jeremy,

You can use:
For i = x To Sheets.Count
Sheets("Ind Templates").Rows("1:15").Copy Sheets(i).Range("A1")
Next

This is bad syntax:

sh.Paste sh.Range = ("A1"

But even if it was arranged as sh.Paste sh.Range("A1")

It would not work because it is not on the same line as the Copy command.
You would have to use PasteSpecial with one of the Paste:=xl constants to
access the clipboard and make it paste.

I still goof this up once in a while. Look over the examples in the help
files and read the remarks. After a while it starts to make sense.


"J.W. Aldridge" wrote in message
...
Error.... object doesnt support this property or method



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
Error: If Range("AZ" & intCounter).Text = "" Then [email protected] Excel Programming 7 January 21st 08 02:38 PM
Error Help - Method "Range" of object "_Worksheet" failed. Alan Smith Excel Programming 3 March 15th 07 06:55 PM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM
What is Error "Method "Paste" of object "_Worksheet" failed? vat Excel Programming 7 February 17th 06 08:05 PM
"Subscript out of range" error for: Workbooks("Test1.xls").Save Just12341234 Excel Programming 2 June 17th 05 03:16 PM


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"