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

-----Original Message-----
From: rf1234 rf1234 <rfhyd1...@gmail.com>
Date: Thu, 25 Feb 2010 10:58:18 
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

Reply via email to