A question about looping in VBA

Filip_L

New Member
Joined
Apr 21, 2015
Messages
8
Hi,

I would like to execute the below code to look for predetermined values in column A of Sheet4, find them in Sheet3, copy values 3 rows down and 1 column right off the found value and paste them to Sheet4 column C.

The thing is, it would be best if the code could work no matter how many rows in column A of Sheet 4 there are, i.e. if there appear new values, they would also be looked for in in Sheet3. I am assuming the loop would help here, but I am not sure how to code it.

I have the below, which works to look for value in cell A2 of Sheet4.

Set fnd6G2 = Sheet3.Cells.Find(Sheet4.<wbr>Range("A2"), , xlValues, xlPart, xlByRows, xlNext)
If Not fnd Is Nothing Then
fnd6G2.Offset(3, 1).Copy
End If
Sheet4.Range("C2").PasteSpecial xlPasteValuesAndNumberFormats

Could anyone help to customize it so that it works as in the above description?

Big Thanks,
Filip
<wbr>
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
for j=1 to cells(1,26)
next j

say cell Z1 = 99

then it loops 99 times
make Z1 = counta......whatever your column is....
 
Upvote 0

Forum statistics

Threads
1,203,562
Messages
6,056,086
Members
444,845
Latest member
dpkane512

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