Use Input Box to Name Adjacent Ranges
Whoever will help:
I have some code that goes to the first empty range on a given row and
then pastes in a template. It then askes the user via an input box
what to name the template (which is serving to store scenario values
possibly exceeding the number the scenario manager can handle).
Here is the code so far:
Sub AddVoiceScenario()
Dim NewVoice As String
Sheets("Voice Capture").Select
Range("B4:C48").Select
Selection.Copy
Sheets("Scenarios").Select
Range("B10").Select
Do While ActiveCell.Value = "Current"
ActiveCell.Offset(0, 3).Select
Loop
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
NameScenario:
On Error GoTo Handler
NewVoice = InputBox("Please enter a name for this scenario. (The
name may include underscores but no spaces.)")
At this point I want the range where the paste operation just occurred
to be named whatever the user entered into the InputBox (i.e., name
the range the current value of "NewVoice").
Thanks to anyone who can help.
|