-
How can you read with a VBA Excel Sub a vector from the worksheet?
Let's say I have a worksheet in Excel. The purpose of the Sub is to read various vectors through an InputBox, without the Sub asking the user the number of elements for that vector.
I assume:
[vba]
Sub vect()
Dim aVector as Range
Set aVector = Application.InputBox = ("Vector range", type:=8)
' Display the vector trough Debug.Print
End Sub
[/vba]
Thank you.
-
You'll need to remove one = sign and add some handling
[VBA]Sub vect()
Dim aVector As Range
On Error Resume Next
Set aVector = Application.InputBox ("Vector range", type:=8)
On Error GoTo 0
if aVector Is Nothing Then
MsgBox "cancel pressed."
Else
MsgBox aVector.Address(,,,True) & " selected"
End If
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules