Beginner VB Questions


Hello:

Greetings to all. I am new to VB programming and I have encountered a problem that has stopped me cold in my tracks. The code below should serve to illuminate my problem:

Sub GetInput()
Dim foundValue As Variant
Dim textToFind As Variant
Dim rangeToSearch As Range

'RangeToSearch is two columns wide

Set rangeToSearch = Workbooks("2002 EIQ.Xls").Sheets("sheet13").Range_("B4:C133")

When I run the code up to this point the error message "Subscript out of range" is issued.Following the advise of the "Help Menu" I make the following corrections:

Dim rangeToSearch() As Range
rangeToSearch(LBound(rangeToSearch)) = 130
'RangeToSearch is two columns wide
Set rangeToSearch = Workbooks("2002 EIQ.Xls").Sheets("sheet13").Range_("B4:C133")

When I run the code up to this point the error message "Can't assign to an array" is issued. If anyone can point me in the right direction I would appreciate it greatly.

Thanks,
Chris

Comments

  • :
    : Hello:
    :
    : Greetings to all. I am new to VB programming and I have encountered a problem that has stopped me cold in my tracks. The code below should serve to illuminate my problem:
    :
    : Sub GetInput()
    : Dim foundValue As Variant
    : Dim textToFind As Variant
    : Dim rangeToSearch As Range
    :
    : 'RangeToSearch is two columns wide
    :
    : Set rangeToSearch = Workbooks("2002 EIQ.Xls").Sheets("sheet13").Range_("B4:C133")
    :
    : When I run the code up to this point the error message "Subscript out of range" is issued.Following the advise of the "Help Menu" I make the following corrections:
    :
    : Dim rangeToSearch() As Range
    : rangeToSearch(LBound(rangeToSearch)) = 130
    : 'RangeToSearch is two columns wide
    : Set rangeToSearch = Workbooks("2002 EIQ.Xls").Sheets("sheet13").Range_("B4:C133")
    :
    : When I run the code up to this point the error message "Can't assign to an array" is issued. If anyone can point me in the right direction I would appreciate it greatly.
    :
    : Thanks,
    : Chris
    :

    '-------------
    i can't help you but, you could go to the advanced vb forum on this site and ask them you'll probly get better help from them.



    Moses 1:39 - "For behold, this is my work and my glory-to bring to pass the immortality and eternal life of man."


    -Troy



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion