VBA. Return values offset loop issues

nhbcai

New Member
Joined
Jun 28, 2011
Messages
18
Hi all,

I have a large data set and would like to have certain values returned from that set in a separate sheet. The values (Names) occur In row D and are 86 lines apart i.e the first occurs in D17 the following D103 the on after D189 and so on. I would like vba that would loop through until the end of row returning those specific values. I fiddled around but have had no luck. Thanks in advance for your help.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try this: I have used sheet2 as source file and sheet3 as destination file. change the name of sheet names according to you and try

Code:
Sub CopyPaste()
Dim i As Long
Sheet3.Range("A:A").ClearContents
Sheet2.Range("D17").Copy Sheet3.Range("A1")
For Each rngCell In Sheet2.Range("D17:D" & Sheet2.Range("D" & Rows.Count).End(xlUp).Row)
    i = i + 1
    If i = 86 Then
     rngCell.Offset(1).Copy Sheet3.Range("A" & Sheet3.Range("A" & Rows.Count).End(xlUp).Row + 1)
    i = 0
    End If
Next
End Sub
 
Upvote 0
What is in column (not row) D between the Names? That is, what is in
D18:D102
D104:D188
etc
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,337
Members
452,907
Latest member
Roland Deschain

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