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:
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?
-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: