Run Time error '1004': Application-defined or object-defined e
How about:
sht.Range(sht.Cells(rwn, 3), sht.Cells(rwn, sht.UsedRange.Columns.Count)).Copy _
destination:=sht.Cells(rwn3, 3)
PBcorn wrote:
I have qualified these ranges but still get "object does not support this
property or method" on the paste line:
sht.Range(sht.Cells(rwn3, 3), sht.Cells(rwn3, c)).Paste
I have checked the paste range, it is the same size as the copied range.
"Dave Peterson" wrote:
Qualify the ranges:
sht.Range(sht.Cells(rwn, 3), sht.Cells(rwn, sht.UsedRange.Columns.Count)).Copy
or
with sht
'notice the leading dots!
.Range(.Cells(rwn, 3), .Cells(rwn, .UsedRange.Columns.Count)).Copy
end with
If the code is behind a worksheet, those unqualified ranges refer to the sheet
with the code.
If the code is in a general module, then those unqualified ranges refer to the
activesheet.
PBcorn wrote:
I have the following line of code* causing the above error:
sht.activate
*sht.Range(Cells(rwn, 3), Cells(rwn, sht.UsedRange.Columns.Count)).Copy
this is within a for-next loop:
For Each sht In ThisWorkbook.Worksheets
next sht
rwn is an integer from a line within a another for-next loop:
rwn = cll.row
why is this causing an error?
--
Dave Peterson
--
Dave Peterson
|