Consulting

Results 1 to 7 of 7

Thread: Defining Dynamic Named Ranges with VBA

  1. #1
    VBAX Regular
    Joined
    Dec 2015
    Posts
    10
    Location

    Defining Dynamic Named Ranges with VBA

    Hi Friends

    I have a Problem in VBA and looking for solution for my case .
    I want to insert Dynamic Spark lines in my excel, so I have to define Dynamic Range for that and assign it to my spark lines, I did it with Offset and Count function . My problem is that there are so many Rows ( Abou 200 Rows ) that I should define name ranges for that .
    So I recorded a Macro of defining Name and used a For loop to create Name Ranges . my Problem is that it refers to RC Ranges that wont work in excel .
    I insert 3 pics to show my problem.

    33.jpg111.jpg222.jpg

    I would be so thankful if u guys help me on that.

  2. #2
    Why are you defining dynamic names for the sparklines?
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Regular
    Joined
    Dec 2015
    Posts
    10
    Location
    Quote Originally Posted by Jan Karel Pieterse View Post
    Why are you defining dynamic names for the sparklines?
    Becuz , my data will be updated daily and my range should be dynamic so that i can have it in my spark line .

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Weird.
    Nevertheless, try:
    "=OFFSET(Sheet1!R" & i & "C4,0,0,COUNT(Sheet1!R2C4:R2C9))"
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    VBAX Regular
    Joined
    Dec 2015
    Posts
    10
    Location
    Quote Originally Posted by p45cal View Post
    Weird.
    Nevertheless, try:
    "=OFFSET(Sheet1!R" & i & "C4,0,0,COUNT(Sheet1!R2C4:R2C9))"
    It gives me syntax error

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    'It' doesn't, but:
    Name:=x
    might (unless you have a variable x containing a valid name as a string).
    Change it to:
    Name:="x"

    I can't tell if there's anything in cells C5 and C6 from your pictures.
    Last edited by p45cal; 02-01-2016 at 06:13 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  7. #7
    VBAX Regular
    Joined
    Dec 2015
    Posts
    10
    Location
    Quote Originally Posted by p45cal View Post
    Weird.
    Nevertheless, try:
    "=OFFSET(Sheet1!R" & i & "C4,0,0,COUNT(Sheet1!R2C4:R2C9))"

    Tnx So much Buddy, Worked Perfect , My bad for wrong copy and paste !
    U r pro Buddy

Posting Permissions

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