Consulting

Results 1 to 3 of 3

Thread: Solved: Automating histograms

  1. #1

    Solved: Automating histograms

    Below is the start of my code to automate histograms. Can anyone tell me why it doesn't work? Thanks,
    [VBA]

    Sub Histrogram()
    Dim Input_Range As Range
    Dim Output_Range As Range
    Dim Bin_Range As Range
    Set Input_Range = Application.InputBox("Choose the input range.", _
    "Input Range", Selection.Address, , , , , 8)
    Set Output_Range = Application.InputBox("Choose the output range.", _
    "Output Range", Selection.Address, , , , , 8)
    Set Bin_Range = Application.InputBox("Choose the bin range.", _
    "Bin Range", Selection.Address, , , , , 8)
    Application.Run "ATPVBAEN.XLA!Histogram", _
    Sheets("Sheet1").Range("Input_Range") _
    , Sheets("Sheet1").Range("Output_Range"), _
    Sheets("Sheet1").Range("Bin_Range") _
    , False, False, False, False
    End Sub
    [/VBA]

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Welcome to VBAX
    Input/Output_Range are variables and have no value used as string values in Range("Input_Range"). Add these as range names or adjust your string to incorporate the addresses

    e.g.
    [vba]
    ActiveWorkbook.Names.Add Name:="Input_Range", RefersTo:= _
    "=Sheet1!" & Input_Range.address
    [/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
    Perfect. Thank you.

Posting Permissions

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