+ Reply to Thread
Results 1 to 7 of 7

How to write a range

Hybrid View

  1. #1
    Registered User
    Join Date
    02-14-2010
    Location
    Preston England
    MS-Off Ver
    Excel 2007
    Posts
    23

    How to write a range

    In my Excel applications I prefer to have the columns labelled with numbers rather than A, B, C,... etc.

    In plotting a chart using VBA and setting a range with an instruction such as :

    Set rng = ActiveSheet.Range("A24:M27")

    I should like to know how to write the range if the columns are numbered rather than lettered, please.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to write a range

    Set rng = ActiveSheet.Range(cells(24,1), Cells(27,13))
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    16,024

    Re: How to write a range

    You can use
    Set rng = ActiveSheet.Range("A24:M27")
    regardless of whether you're sheet uses A1 or R1C1 references

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: How to write a range

    Hello dcwm,

    If you want to translate the A1 address to R1C1...
        Dim addx As String
    
            addx = Split(Range("A24:M27").Address(False, False, xlR1C1, True), "!") (1)
    Returns...
        R[23]C:R[26]C[12]
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to write a range

    Or just

    addx = Range("A24:M27").Address(False, False, xlR1C1)
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    02-14-2010
    Location
    Preston England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: How to write a range

    Thank you for that.

  7. #7
    Registered User
    Join Date
    02-14-2010
    Location
    Preston England
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: How to write a range

    Thank you for that

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Is it possible to write a formula outside a range to affect a cell inside the range?
    By jsagolf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-30-2019, 09:53 AM
  2. [SOLVED] write a collection to a range
    By aprildu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-11-2016, 03:36 PM
  3. How to write an IF formula using a range?
    By Glh222 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-15-2013, 08:05 PM
  4. write array to range
    By muster in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-22-2006, 07:40 PM
  5. [SOLVED] write a formula to a range
    By Martin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2006, 06:40 AM
  6. Please help to write : Countif (range: >x and <y)
    By EduardoDon in forum Excel General
    Replies: 3
    Last Post: 05-20-2005, 10:28 AM
  7. write to range
    By hke in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2005, 11:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1