Need to find named ranges in Excel

A

Andy S.

I'm trying to write an activex script to read in all the named ranges that
end with a $ in an Excel workbook from a DTS package. I've gotten as far as
grabbing the filename of the excel file. I've been trying to find an answer
without much luck, does anyone have any suggestions?


--

*************************************************
Andy S.
(e-mail address removed)

Please remove "noreply" before replying.


*************************************************
 
N

Norman Jones

Hi Andy,

You do not need code to find ranges ending with the $ character: there are
none!

The $ character is not legal in Excel names.

Assuming, however, that the $ character was merely an example, try something
like:

Public Sub TestNames()

Dim Nme As Name
Const LastLetter As String = "D"

For Each Nme In ActiveWorkbook.Names
If UCase(Right(Nme.Name, 1)) = LastLetter Then
MsgBox Nme.Name
End If
Next

End Sub
 
A

Andy S.

Thanks, that definitely will get me started. $ is what DTS Designer shows
for named ranges that are the worksheet name when you try to import from a
worksheet. I thought they'd be the same for activex script, but I was
wrong.
 

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