Consulting

Results 1 to 3 of 3

Thread: Solved: Dynamical generate name ranges

  1. #1
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    294
    Location

    Solved: Dynamical generate name ranges

    Hi

    Is it possible to dynamically generate name ranges based on information in columns B and C......and that the name range always follow a set pattern....

    =(Vol_Alternative_Suppliers_Other_Markets_EU * Price_Other_Markets_EU_Alternative_Suppliers) - (Vol_Alternative_Suppliers_Other_Markets_EU * (Price_Alternative_Suppliers_Other_Markets_EU + UFC_Alternative_Suppliers_Other_Markets_EU))

    the only part of the formula tha changes is the supply customer name and the demand customer name........

    in the shown example i.e.

    Vol_Alternative_Suppliers_Other_Markets_EU

    Alternative_Supplier = Supply customer and

    Other_Markets_EU - Demand customer...

    see attached workbook........

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I may be completely misunderstanding this, and there would need to be code to set the RefersTo range.
    [VBA]
    Sub naming()
    Set Rng = Range(Cells(6, 2), Cells(Rows.Count, 2).End(xlUp))
    For Each cel In Rng
    If cel <> "" And cel.Offset(, 1) <> "" Then
    ActiveWorkbook.Names.Add "Vol_" & cel.Text & "_" & cel.Offset(, 1).Text, _
    RefersTo:="C:\AAA\[SIL-Model-7-c20c.xls]Modelling(Vol)!$F$6:$BA$6"
    End If
    Next
    End Sub

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    294
    Location
    thanks for the feed back.......taking a different approach to the question...

Posting Permissions

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