ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range Name with VBA Exciting :) or Nightmare :( (https://www.excelbanter.com/excel-programming/384521-range-name-vba-exciting-nightmare.html)

Kieranz[_2_]

Range Name with VBA Exciting :) or Nightmare :(
 
Hi All,
Using Excel 2003 with XP. I am learning quite a bit about range names
as applied on the sheets with the help of many of you MVPs. But... i
am trying to learn how to manipulate with VBA. Below is the code
which kind of works having created the range name first. I would like
to work with strings and dates and numerics and am getting really
stuck. Maybe even if u could point me to a website. Thks. Rgds KZ.

Sub tryRN_FirstNames()
Dim sFN
sFN = Names.Item("rnFName")
MsgBox sFN

sFN = "XYZ"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN

sFN = "ABC"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN
End Sub


Bob Phillips

Range Name with VBA Exciting :) or Nightmare :(
 
See http://www.xldynamic.com/source/xld.Names.html#vba

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Kieranz" wrote in message
oups.com...
Hi All,
Using Excel 2003 with XP. I am learning quite a bit about range names
as applied on the sheets with the help of many of you MVPs. But... i
am trying to learn how to manipulate with VBA. Below is the code
which kind of works having created the range name first. I would like
to work with strings and dates and numerics and am getting really
stuck. Maybe even if u could point me to a website. Thks. Rgds KZ.

Sub tryRN_FirstNames()
Dim sFN
sFN = Names.Item("rnFName")
MsgBox sFN

sFN = "XYZ"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN

sFN = "ABC"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN
End Sub




Kieranz[_2_]

Range Name with VBA Exciting :) or Nightmare :(
 
On Mar 5, 4:16 pm, "Bob Phillips" wrote:
Seehttp://www.xldynamic.com/source/xld.Names.html#vba

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Kieranz" wrote in message

oups.com...

Hi All,
Using Excel 2003 with XP. I am learning quite a bit about range names
as applied on the sheets with the help of many of you MVPs. But... i
am trying to learn how to manipulate with VBA. Below is the code
which kind of works having created the range name first. I would like
to work with strings and dates and numerics and am getting really
stuck. Maybe even if u could point me to a website. Thks. Rgds KZ.


Sub tryRN_FirstNames()
Dim sFN
sFN = Names.Item("rnFName")
MsgBox sFN


sFN = "XYZ"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN


sFN = "ABC"
Names.Item("rnFName").RefersTo = sFN
sFN = Names.Item("rnFName")
MsgBox sFN
End Sub



Many thks Bob.
Rgds KZ



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

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