J
jurgenC!
hi all,
rather frustrated as i am unable to determine where i am going wrong on
following code:
Sub insertRow()
Dim rRange As Range
Application.ScreenUpdating = True
output = 666
Prompt = "Select Destination:"
Title = "Insert Row"
'Display the Input Box
On Error Resume Next
Set rRange = Application.InputBox( _
Prompt:=Prompt, _
Title:=Title, _
Default:=ActiveCell.Address, _
Type:=8)
On Error GoTo 0
If rRange Is Nothing Then
MsgBox "Cancelled"
Else
rRange.Range("A1") = output
End If
End Sub
the above code will only execute correctly if the destination cell is
visible on the screen.
however, if the destination cell is not visible on the screen and i
therefore either scroll or enter the destination by key - the
"Cancelled" message box is displayed (instead of entering "666" into the
destination cell) after clicking 'OK'.
in despair i added the 'ScreenUpdating' command hoping this would
rectify the error, but to no avail.
any help is mostly appreciated as to how i would be able to scroll
through a worksheet while the Input Box awaits an entry and after
selecting the destination cell, this address to be stored.
cheers....
...jurgenC
rather frustrated as i am unable to determine where i am going wrong on
following code:
Sub insertRow()
Dim rRange As Range
Application.ScreenUpdating = True
output = 666
Prompt = "Select Destination:"
Title = "Insert Row"
'Display the Input Box
On Error Resume Next
Set rRange = Application.InputBox( _
Prompt:=Prompt, _
Title:=Title, _
Default:=ActiveCell.Address, _
Type:=8)
On Error GoTo 0
If rRange Is Nothing Then
MsgBox "Cancelled"
Else
rRange.Range("A1") = output
End If
End Sub
the above code will only execute correctly if the destination cell is
visible on the screen.
however, if the destination cell is not visible on the screen and i
therefore either scroll or enter the destination by key - the
"Cancelled" message box is displayed (instead of entering "666" into the
destination cell) after clicking 'OK'.
in despair i added the 'ScreenUpdating' command hoping this would
rectify the error, but to no avail.
any help is mostly appreciated as to how i would be able to scroll
through a worksheet while the Input Box awaits an entry and after
selecting the destination cell, this address to be stored.
cheers....
...jurgenC