Method 'Range" of object'_Global' failed

G

Guest

I get this error when i try to run, how could i place variables in the selection


Sheets("Eclipse").Selec
Range("A1").Selec
Cells.Find(What:="wopr", After:=ActiveCell, LookIn:=xlFormulas, LookAt
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=
False).Activat
Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
.Activat
x = Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
.Activat
y = Selection.End(xlDown).Selec
Range("A$x:A$y").Select <-----------------------------------------------------------------Problem lin
Application.CutCopyMode = Fals
Selection.Cop
Sheets("Sheet1").Selec
Range("D2").Selec
ActiveSheet.Past

End Sub
 
M

Medemper

Not sure if you wanted to search for the 2nd "7p2" after wopr or not.

Sub FindAndCopy()
Sheets("Eclipse").Select
Range("A1").Select
Cells.Find(What:="wopr", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Select
x = ActiveCell.Address
Selection.End(xlDown).Select
y = ActiveCell.Address
Range(x, y).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D2").Select
ActiveSheet.Paste

End Sub

I get this error when i try to run, how could i place variables in the selection.



Sheets("Eclipse").Select
Range("A1").Select
Cells.Find(What:="wopr", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate
Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
x = Cells.Find(What:="7p2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
y = Selection.End(xlDown).Select
Range("A$x:A$y").Select <-----------------------------------------------------------------Problemline
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D2").Select
ActiveSheet.Paste

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top