Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    R1C1 Sheet Name (Excel 2003)

    For the code below, can I pass in the sheet name as a variable to replace the name "Data"?

    Worksheets(sheetName).Activate
    r = row
    ActiveWorkbook.Names.Add Name:="BenchmarkId", RefersToR1C1:="='Data'!R" & r & col

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: R1C1 Sheet Name (Excel 2003)

    Sure:

    Dim sSheetname as String
    sSheetName="Data"
    ActiveWorkbook.Names.Add Name:="BenchmarkId", RefersToR1C1:="='" & sSheetName & "'!R" & r & col

    Note there are single and double quotes in the line above, look carefully!
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Lounger
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: R1C1 Sheet Name (Excel 2003)

    Thanks!

Posting Permissions

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