Application.goto Runtime Error

Santaflare

New Member
Joined
Jan 4, 2017
Messages
15
Hi,

-I’m trying to construct a function that will enable auser to filter data by selecting a specific name in a pre-defined cell.

I’m using this code:


Code:
Sub Find_W2()
    Dim FindString As String
    Dim Rng As Range
    FindString = Sheets("Data").Range("I30").Value
    If Trim(FindString) <> "" Then
        With Sheets("Data").Range("D:D")
            Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
            If Not Rng Is Nothing Then
[COLOR=#ff0000]                Application.Goto Rng, True[/COLOR]
            Else
                MsgBox "Namn saknas"
            End If
        End With
        Worksheets("Data").Activate
        Selection.Offset(rowOffset:=0, columnOffset:=12).Activate
        Selection.Offset(0, -7).Resize(Selection.Rows.Count + 0, _
        Selection.Columns.Count + 11).Select
        Selection.Copy
        Call Phase2
    End If
End Sub



Column D is where the names are, and the columns I-T contains the actual data for each row.

When I try to run the macro I get runtime error 1004 with the message that the method ‘Goto’ in the object ‘_Application’ failed.

(The red text.)


Previously the code worked just fine, but recently this message is shown every time the macro is activated.

Any thoughts as to why, and what I might do to remedy the situation?


 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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