ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Named Ranged, help please (https://www.excelbanter.com/excel-programming/415475-named-ranged-help-please.html)

Simon[_2_]

Named Ranged, help please
 
Cell E3 is called "Latest"

In this column I offset to paste vlaues in from other sheets intop the
relvant ow (determined by the offset - could you Lookup I guess).
However do I need to Dim the range to ge tthe following to work?

MyWBAccRep.Sheets("Volumes").Range("Latest").Copy
Destination:=Range("Latest").Offset(0, 1)

Thanks

joel

Named Ranged, help please
 
Named ranges are not part of a workbook but part of the application level of
a workbook. Try this

from
MyWBAccRep.Sheets("Volumes").Range("Latest").Copy

to
MyWBAccRep.application.Sheets("Volumes").Range("La test").Copy


"Simon" wrote:

Cell E3 is called "Latest"

In this column I offset to paste vlaues in from other sheets intop the
relvant ow (determined by the offset - could you Lookup I guess).
However do I need to Dim the range to ge tthe following to work?

MyWBAccRep.Sheets("Volumes").Range("Latest").Copy
Destination:=Range("Latest").Offset(0, 1)

Thanks


Jim Thomlinson

Named Ranged, help please
 
You need to be explicit with your references. You are good on the copy but
you are not explicit on your destination...

With MyWBAccRep.Sheets("Volumes").Range("Latest")
.Copy Destination:=.Offset(0, 1)
end with

What you have is equavalent to
MyWBAccRep.Sheets("Volumes").Range("Latest").Copy
Destination:=Activesheet.Range("Latest").Offset(0, 1)

so if Latest is not on the active sheet it will bomb...

--
HTH...

Jim Thomlinson


"Simon" wrote:

Cell E3 is called "Latest"

In this column I offset to paste vlaues in from other sheets intop the
relvant ow (determined by the offset - could you Lookup I guess).
However do I need to Dim the range to ge tthe following to work?

MyWBAccRep.Sheets("Volumes").Range("Latest").Copy
Destination:=Range("Latest").Offset(0, 1)

Thanks


Jim Thomlinson

Named Ranged, help please
 
I think you are mistaken. Range names are either tied to the Workbook for
global named ranges or to the worksheet for local named ranges. The Object
Model is
Application - Workbooks - Worksheets
The appliation contains 0 or more workbooks. A Workbook contains 1 or more
worksheets. A workbook can not contain an application.

If you check the value of Thisworkbook.Application and ThisWorkbook.Parent
you will see that they are both the same.
--
HTH...

Jim Thomlinson


"Joel" wrote:

Named ranges are not part of a workbook but part of the application level of
a workbook. Try this

from
MyWBAccRep.Sheets("Volumes").Range("Latest").Copy

to
MyWBAccRep.application.Sheets("Volumes").Range("La test").Copy


"Simon" wrote:

Cell E3 is called "Latest"

In this column I offset to paste vlaues in from other sheets intop the
relvant ow (determined by the offset - could you Lookup I guess).
However do I need to Dim the range to ge tthe following to work?

MyWBAccRep.Sheets("Volumes").Range("Latest").Copy
Destination:=Range("Latest").Offset(0, 1)

Thanks



All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com