ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ranges of Named Fields (https://www.excelbanter.com/excel-programming/343234-ranges-named-fields.html)

affordsol

Ranges of Named Fields
 
Hi to all !

In Excel 97, I try to get the range of the existing fields : by example

FieldName range
namedProf Param2!$A$1:$A$50

I use the following code :
Dim intPtr1 As Integer
'
Sheets("Content").Select
Range("G2").Activate
ActiveCell = "NamedFields"
For intPtr1 = 1 To Application.ActiveWorkbook.Names.Count
ActiveCell.Offset(intPtr1, 1) =
Application.ActiveWorkbook.Names(intPtr1).Name
ActiveCell.Offset(intPtr1, 2) = Names(intPtr1).RefersTo
Next intPtr1

but the results are not OK

Can anyone help ??

Thanks by advance and regards from Belgium.



Tom Ogilvy

Ranges of Named Fields
 
if you trying to write a list of names and there refers to

Dim intPtr1 As Integer
'
Sheets("Content").Select
Range("G2").Activate
ActiveCell = "NamedFields"
For intPtr1 = 1 To Application.ActiveWorkbook.Names.Count
ActiveCell.Offset(intPtr1, 1) =
Application.ActiveWorkbook.Names(intPtr1).Name
ActiveCell.Offset(intPtr1, 2) = "'" & Names(intPtr1).RefersTo
Next intPtr1
Next

or you could try

Sheets("Content").Select
Range("G2").Activate
Selection.ListNames

--
Regards,
Tom Ogilvy


"affordsol" wrote in message
...
Hi to all !

In Excel 97, I try to get the range of the existing fields : by example

FieldName range
namedProf Param2!$A$1:$A$50

I use the following code :
Dim intPtr1 As Integer
'
Sheets("Content").Select
Range("G2").Activate
ActiveCell = "NamedFields"
For intPtr1 = 1 To Application.ActiveWorkbook.Names.Count
ActiveCell.Offset(intPtr1, 1) =
Application.ActiveWorkbook.Names(intPtr1).Name
ActiveCell.Offset(intPtr1, 2) = Names(intPtr1).RefersTo
Next intPtr1

but the results are not OK

Can anyone help ??

Thanks by advance and regards from Belgium.






All times are GMT +1. The time now is 12:28 AM.

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