ADDin

R

rjtaylor

I need some help accessing a named range. the range is on a sheet in a
addin I can call it with no problem from a module in the addin however
now need to access it form a module iether in another addin or from th
open workbook How do I do this. thanks
Ro
 
D

Dave Peterson

You can refer to that range just like any other range:

Dim myRng As Range
With Workbooks("YourAddinName.xla").Worksheets("YourWorksheetName")
Set myRng = .Range("a1:e" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With

This example used A1:E(last used row in column A).

Then do pretty much anything you want with it.
 
R

rjtaylor

Do I have to use the set command. Normally i just refer to the rang
name allready set up on the workbook
i.e. Range("CONT_INT").Copy
thanks for the repla
 
D

Dave Peterson

That's fine, but I would think you'd need to include the workbook/addin name:

workbooks("myaddin.xla").worksheets("sheet1").range("cont_int").copy

(I like to include all the qualifiers, including the worksheet--even though it's
not always necessary.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top