ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Searching for name series (https://www.excelbanter.com/excel-programming/433981-searching-name-series.html)

Cantru

Searching for name series
 
Hi all,

I have a series of names defined as

defMac1
defMac2
defMac3
....
defMac18
I'll like to write a code to look for each name and do other code,
everything inside a loop.
Something similar to:

Sub defmac()
Dim n As Name
Dim x as Integer
x = 1
For Each n In ActiveWorkbook.Names.Item(defMac(x))
i=i+1
x=x+1
Next n
Msgbox i
End Sub

Of course this code doesn't work , but hope you get the idea. Anny ideas.

Thanks.


Don Guillett

Searching for name series
 
What are you trying to do with each defined name?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cantru" wrote in message
...
Hi all,

I have a series of names defined as

defMac1
defMac2
defMac3
...
defMac18
I'll like to write a code to look for each name and do other code,
everything inside a loop.
Something similar to:

Sub defmac()
Dim n As Name
Dim x as Integer
x = 1
For Each n In ActiveWorkbook.Names.Item(defMac(x))
i=i+1
x=x+1
Next n
Msgbox i
End Sub

Of course this code doesn't work , but hope you get the idea. Anny ideas.

Thanks.



Cantru

Searching for name series
 
Let me explain a little bit.

A have a range that is updated everythime a new month is written, then I
copy the generated data in this region to another cell, one for each month.
This means that
defMac1 is January
defMac2 is February and so on. My current code is written 12 times, one for
each month. I'm looking for something shoter.

Hope this explains enough, let me know.

Thanks.

"Don Guillett" wrote:

What are you trying to do with each defined name?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cantru" wrote in message
...
Hi all,

I have a series of names defined as

defMac1
defMac2
defMac3
...
defMac18
I'll like to write a code to look for each name and do other code,
everything inside a loop.
Something similar to:

Sub defmac()
Dim n As Name
Dim x as Integer
x = 1
For Each n In ActiveWorkbook.Names.Item(defMac(x))
i=i+1
x=x+1
Next n
Msgbox i
End Sub

Of course this code doesn't work , but hope you get the idea. Anny ideas.

Thanks.




Don Guillett

Searching for name series
 
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You send a clear explanation of what you want
3. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cantru" wrote in message
...
Let me explain a little bit.

A have a range that is updated everythime a new month is written, then I
copy the generated data in this region to another cell, one for each
month.
This means that
defMac1 is January
defMac2 is February and so on. My current code is written 12 times, one
for
each month. I'm looking for something shoter.

Hope this explains enough, let me know.

Thanks.

"Don Guillett" wrote:

What are you trying to do with each defined name?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Cantru" wrote in message
...
Hi all,

I have a series of names defined as

defMac1
defMac2
defMac3
...
defMac18
I'll like to write a code to look for each name and do other code,
everything inside a loop.
Something similar to:

Sub defmac()
Dim n As Name
Dim x as Integer
x = 1
For Each n In ActiveWorkbook.Names.Item(defMac(x))
i=i+1
x=x+1
Next n
Msgbox i
End Sub

Of course this code doesn't work , but hope you get the idea. Anny
ideas.

Thanks.






All times are GMT +1. The time now is 08:49 PM.

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