Hi all,
First time poster and a novice at using vba but learning quickly. The more I learn the more impressed I am by how vba can make life so much easier if you have to constantly update data in spreadsheets...............which my employer loves (why bother asking someone if they take suger in their coffee when you can create a spreadsheet that contains everyones sugar requirements and then tell some poor sod to keep it updated).
I am trying to use a vba code to copy data from various cells on one worksheet (leaving out hidden cells) and then paste the data into every seventh row on a second worksheet (in the same workbook). I have used an editing vba code found on this site to copy and paste the data as required but the code is also copying data from hidden rows.
The code that i am using is......
Sub CopyDataEvery7th()
Dim i As Long, j As Long, nLastRow As Long
Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = Worksheets("ExDRIE")
Set ws2 = Worksheets("List")
nLastRow = ws1.Cells(ws1.Rows.Count, "A").End(xlUp).Row
'Start on Row 13 with List
j = 4
For i = 13 To nLastRow
'Copy Code
ws2.Cells(j, "A") = ws1.Cells(i, "I")
'Copy Name
ws2.Cells(j, "B") = ws1.Cells(i, "H")
'Copy ID2
ws2.Cells(j, "C") = ws1.Cells(i, "D")
'With List every Seventh Row
j = j + 7
Next i
End Sub
Thanks in advance for any help
Bookmarks