Hi Harpreet Gujral, Below is the solution for your query. I have used range B1:B10 for name "Deepak" in the below code. You can customize the syntax as per your requirement.
Range("B1:B10").Select ActiveWorkbook.Names.Add Name:="Deepak", RefersTo:=Range("B1:B10") Hope this is what you are looking for. Please revert in case it doesn't work. Thanks, Deepak Rai On Thu, Feb 25, 2010 at 2:58 PM, Harpreet Gujral <harpreetguj...@gmail.com>wrote: > The idea is to name the range and then use it within the macro for ease of > referencing. > > > ActiveWorkbook.Names.Add Name:="Ctr1", RefersToR1C1:=_ Strshtname & > "R1C1:R2C3" > > I am talking about 'referstoR1C1'. For this we have to give range in terms > of R1C1 reference style. Can we name a range in the other reference style. > The problem is it is easy to reference cell A1 by saying A1 in the formula > than R1C1. > > Please suggest. > > Harpreet > > Sent on my BlackBerry® from Vodafone Essar > ------------------------------ > *From: *rf1234 rf1234 <rfhyd1...@gmail.com> > *Date: *Thu, 25 Feb 2010 12:28:08 +0530 > *To: *<harpreetguj...@gmail.com> > *Cc: *<excel-macros@googlegroups.com> > *Subject: *Fwd: $$Excel-Macros$$ Named Ranges > > Dear Harpreet R1C1 is used to declare or use formula file > using macro. > i think if you want to run any formula or function u can directly write in > excel formula window (fx) or in macro difining R1C1. > > > I hope it will help. > > > > On Thu, Feb 25, 2010 at 11:18 AM, Harpreet Gujral < > harpreetguj...@gmail.com> wrote: > >> Thanks for your advice. >> >> I think we deviated a bit from the topic. >> I m looking for a alternative referencing technique used in the macro code >> that I have pasted in my email. The problem is that the code uses R1C1 >> referencing style.can we change it? >> >> The solution provided is good to use if we don't want to give a specific >> name to the range in question. >> >> Regards >> >> Harpreet Gujral >> >> Sent on my BlackBerry® from Vodafone Essar >> ------------------------------ >> *From: *rf1234 rf1234 <rfhyd1...@gmail.com> >> *Date: *Thu, 25 Feb 2010 10:58:18 +0530 >> *To: *<excel-macros@googlegroups.com> >> *Cc: *<harpreetguj...@gmail.com> >> *Subject: *Re: $$Excel-Macros$$ Named Ranges >> >> 'Named ranges are a great capability provided by Excel. You can define all >> sorts of named ranges in a workbook, >> ' but how do you access them when creating macros? This tip explains the >> different ways you can access those ranges. >> '(This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel >> 2003, and Excel 2007.) >> >> >> >> >> >> ''''''''''''''''''''I HAVE USE TWO RANGE A1:D5 & A6:D10 TO SHOW RAND >> FUNCTION USE. >> Option Explicit >> Sub Random() >> Dim myRange1 As Range >> 'Dim myRange2 As Range >> Set myRange1 = Worksheets("Sheet1").Range("A1:D5") >> myRange1.Formula = "=RAND()" >> myRange1.Font.Bold = True >> myRange1.Font.Color = vbBlue >> Set myRange1 = Worksheets("Sheet1").Range("A6:D10") >> myRange1.Formula = "=RAND()" >> myRange1.Font.Bold = True >> myRange1.Font.Color = vbYellow >> End Sub >> >> >> '''''''''''HOPE IT WILL WORK NOW >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Thu, Feb 25, 2010 at 9:06 AM, Harpreet Singh Gujral < >> harpreetguj...@gmail.com> wrote: >> >>> Hi Group, >>> >>> In order to name ranges i use the following code: >>> >>> ActiveWorkbook.Names.Add Name:="Ctr1", RefersToR1C1:=_ >>> Strshtname & "R1C1:R2C3" >>> >>> It uses R1C1 referrencing, can we use the other referrencing for this >>> code >>> >>> Thanks >>> >>> Harpreet Gujral >>> >>> >>> -- >>> >>> ---------------------------------------------------------------------------------- >>> Some important links for excel users: >>> 1. Follow us on TWITTER for tips tricks and links : >>> http://twitter.com/exceldailytip >>> 2. Join our Facebook Group @ >>> http://www.facebook.com/group.php?gid=287779555678 >>> 3. Excel tutorials at http://www.excel-macros.blogspot.com >>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com >>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com >>> >>> To post to this group, send email to excel-macros@googlegroups.com >>> >>> <><><><><><><><><><><><><><><><><><><><><><> >>> HELP US GROW !! >>> >>> We reach over 6,800 subscribers worldwide and receive many nice notes >>> about the learning and support from the group.Let friends and co-workers >>> know they can subscribe to group at >>> http://groups.google.com/group/excel-macros/subscribe >>> >> >> > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our Facebook Group @ > http://www.facebook.com/group.php?gid=287779555678 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > -- Thanks, Deepak Rai -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our Facebook Group @ http://www.facebook.com/group.php?gid=287779555678 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe