PDA

View Full Version : Solved: Automating histograms



Taxpayer'sMo
10-20-2008, 04:43 AM
Below is the start of my code to automate histograms. Can anyone tell me why it doesn't work? Thanks,


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

mdmackillop
10-20-2008, 05:41 AM
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.

ActiveWorkbook.Names.Add Name:="Input_Range", RefersTo:= _
"=Sheet1!" & Input_Range.address

Taxpayer'sMo
10-20-2008, 05:56 AM
Perfect. Thank you.