Correcting Debug '424 Error'

bsmith579

New Member
Joined
Feb 1, 2018
Messages
7
I created the following code below and attached it to a button allowing me to enter a number into Cell A3, click my button and it displays the needed information from another worksheet. Overall it works, but I continue to get a "Run-Time error'424'" msg. What am I missing?

Sub ShowDispo()

Dim Res As Variant
Dim Hold As Range
Set Hold = Range("A3")
Set InitialRange = Sheets("Hold").Range("H:J")
Res = Activate.Vlookup(Hold, InitialRange, 3, True).Value

End Sub
 
Piecing together all suggestions, I believe I have what I am looking for.
Thanks for the help!

Sub Test1()
Dim Result As Variant
Dim myVal As Range
Dim Rng As Range
Dim Dispo As Variant

Set myVal = Range("A3")
Set Rng = Sheets("945 Holds").Range("H:J")
Set Dispo = Range("B2")

Result = Application.VLookup(myVal, Rng, 3, False)

If Not IsError(Result) Then
Dispo.Value = Result
End If

If IsError(Result) Then
MsgBox "Number Not Found"
End If

End Sub
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
The last bit can be combined into 1 IF...

Code:
If Not IsError(Result) Then
    Dispo.Value = Result
Else
    MsgBox "Number Not Found"
End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,200
Messages
6,123,611
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top