Select a .find result VBA

photoGB

New Member
Joined
Nov 19, 2009
Messages
31
Thanks for looking, hope you can help!

I'm trying to select a cell that is the result of a .find function so that i can then select its entire row and copy it onto a new sheet.

My .find function is...


Code:
On Error Resume Next
[FONT=Courier New]With RecordsSheet[/FONT]
 
[FONT=Courier New]Set phoneChk = .Columns(1).Find(What:=phoneNumber, After:=.Cells(1, 1), LookIn:=xlValues, lookat:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)[/FONT]
 
[FONT=Courier New]On Error GoTo 0[/FONT]
 
[FONT=Courier New]If Not phoneChk Is Nothing Then phoneChk.Select[/FONT]
[FONT=Courier New]Run "CopyPaste"[/FONT]

The CopyPaste Sub on a new module is...

Code:
[FONT=Courier New]Sub CopyPaste()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>Application.ScreenUpdating = FalseRecordsSheet.EntireRow.Copy SearchSheet.Range("A65536").End(xlUp).Offset(1, 0)Application.ScreenUpdating = True<o:p></o:p>End Sub[/FONT]


So far I keep getting a "Select method of Range class failed" error message, which fromj what i can gather means the code can't decide what to select.

On changing the Select command to that shown below I get "Method 'Goto' of object '_Application' failed". I'm not sure if this is because the sheets in question are hidden or if there is another error.

Code:
If Not phoneChk Is Nothing Then Application.Goto phoneChk, True





</PRE>
Any help would be much appreciated.

Regards
Garry
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
instead of thsis

Code:
If Not phoneChk Is Nothing Then phoneChk.Select

did you tsry

Code:
If Not phoneChk Is Nothing Then phoneChk.copy

</pre>
 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,305
Members
449,079
Latest member
juggernaut24

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