Sub procedure in Macros
I am trying to insert a 3rd sub procedure to pick a certain worksheet when a
variable is entered in a input box. I can get it to pick a column but it
won't pick a sheet. Does anyone know what I am doing wrong?
Here is what I have done.
Public Sub Show_Histogram()
'
' Histogram Macro
' This macro displays the contents of the Histogram worksheet.
'
'
Dim Source
Source = InputBox("Enter a filler (A-E)", "Specify Bottle Filler")
Source = UCase(Source)
If Source = "A" Or Source = "B" Or Source = "C" Or Source = "D" Or Source =
"E" Then
ActiveWorkbook.Names.Add Name:="Histogram", RefersToR1C1:="=Histogram" &
Source
ElseIf Source < "" Then
MsgBox "Please enter a letter from A to E", vbCritical, "Invalid Filler"
End If
End Sub
Any help would be appreciated.
|