ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   locating and copying (https://www.excelbanter.com/excel-programming/330359-locating-copying.html)

Jimmy Pop

locating and copying
 
Hello, I am a new Macro user and am trying to come up with one that
locates a "specific word" then will copy a cell located 2 cells down
from the specific word and paste it at another specified location.

Can anyone help?

Thanks,
Jimmy


Jim Thomlinson[_4_]

locating and copying
 
Something like this

Sub FindAndCopy()
Dim wksFind As Worksheet
Dim wksPaste As Worksheet
Dim rngFind As Range
Dim rngToSearch As Range
Dim rngPaste As Range

Set wksFind = Sheets("Sheet1")
Set rngToSearch = wksFind.Cells
Set rngFind = rngToSearch.Find("That")
If rngFind Is Nothing Then
MsgBox "Not Found"
Else
Set wksPaste = Sheets("Sheet2")
Set rngPaste = wksPaste.Range("A1")
rngFind.Offset(2, 0).Copy rngPaste
End If

End Sub
--
HTH...

Jim Thomlinson


"Jimmy Pop" wrote:

Hello, I am a new Macro user and am trying to come up with one that
locates a "specific word" then will copy a cell located 2 cells down
from the specific word and paste it at another specified location.

Can anyone help?

Thanks,
Jimmy




All times are GMT +1. The time now is 02:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com