Find text in document and copy that text only

Glasgowsmile

Active Member
Joined
Apr 14, 2018
Messages
280
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have the following VBA

VBA Code:
         Set Fnd = Range("A:A").Find("name id:", , , xlPart, , , False, , False)

and I want to copy that name id information and currently, I'm trying this but it's not working - what am I missing here?
VBA Code:
Range(Fnd.Offset(1)).Copy Sheet2.Range("A1")

I also tried this but I don't know for sure that the data is going to land in A10 each time.
VBA Code:
  Range(Fnd.Offset(1), Range("A10")).Copy Sheet2.Range("A1")
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Fnd is already a range, was that find succesfull ?
if not Fnd is nothing then Fnd.Offset(1).Copy Sheet2.Range("A1")
Range(
 
Upvote 0
Solution
VBA Code:
     Set fnd = Range("A:A").Find("name id:", , , xlPart, , , False, , False)
     fnd.Offset(1).Copy sheet2.Range("A1")
     Set fnd2 = Range(fnd.Offset(1), Range("A10"))
     fnd2.Copy sheets2.Range("A1")
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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