Excel VBA- copy every 9th cell to 'sheet2'

  • Thread starter Thread starter chasbot
  • Start date Start date
C

chasbot

Hello,

I'm still a VBA newbie and am having a difficult time looping the
following:

I want to copy every 9th cell(and value) in column C, 'sheet1' to
consecutive rows in column A, 'sheet 2'.

So, sheet 2 should look like:

_A_
1 x
2 y
3 z

Any help would be appreciated.

Thanks,

Charles
 
Charles,

Try something like the following.


Dim Dest As Range
Dim RowNdx As Long
Set Dest = Worksheets("Sheet2").Range("A1")
For RowNdx = 1 To 100 Step 9 'change start and end values
Dest.Value = Worksheets("Sheet1").Cells(RowNdx, "A").Value
Set Dest = Dest(2, 1) 'move destination down
Next RowNdx

Change the start and end values in the FOR statement as desired.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top