Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Dynamic Range with VBA

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,
    I used this code to try and define a dynamic range. Got it by recording macro. While it is defined in the Insert->Define->Name menu, references to Range("DATABASE") will cause error "Reference is invalid" -- Help??

    xlBook.Names.Add Name:="DATABASE", RefersToR1C1:= _
    "=OFFSET(Sheet1!R1C1,0,0,COUNTA(Sheet1!C1),6)"

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    2 Things

    1. You dynamic range will NOT be dynamic if you just use: "COUNTA(Sheet1!C1)" This will return either 1 or 0

    2. You have "xlBook" I assume this is a Workbook Object variable?? Try using "ActiveWorkbook"


    I have many eaxmples of Dynamic ranges here:

    http://www.ozgrid.com/Excel/DynamicRanges.htm




  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    There are different way to define a dynamic ranges in VBA.. Each way has its own limitations and advantage. It is very difficult to make someone understand on Net.

    If you want to know how to define dynamic ranges goto my website and download file 16.

    Name of the file is "Populating Combobox."

    It demonstrates how you can make the range dynamic.

    I hope you must have some knowledge in VBA.

    I hope you will like to file.

    http://www.pexcel.com/download.htm
    ni****h desai

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Cheers guys.. Got it at last... Me = silly
    Thanks for the files..

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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