Macro problem

T

The Message

I have had someone write me a macro as below. This basically copies the top
10 numbered rows from Sheet 1 and pastes into Sheet 3. However it pastes the
rows starting from Row 1 in Sheet 3 therfore not allowing me to put any
column headings/titles etc. in Sheet 3. I need the info to be pasted from row
8 and below rather than row 1. Any help?

Sub MyMacro()
Dim lngRow As Long, ws As Worksheet, lngNRow As Long
Set ws = Sheets("Sheet3")
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("A" & lngRow) > 0 And Range("A" & lngRow) <= 10 Then
lngNRow = lngNRow + 1: Rows(lngRow).Copy ws.Rows(lngNRow)
End If
Next
End Sub
 
M

Mike H

Hi,

Note the very minor change to the last line befor end if

Sub MyMacro()
Dim lngRow As Long, ws As Worksheet, lngNRow As Long
Set ws = Sheets("Sheet3")
For lngRow = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("A" & lngRow) > 0 And Range("A" & lngRow) <= 10 Then
lngNRow = lngNRow + 1: Rows(lngRow).Copy ws.Rows(lngNRow + 7)
End If
Next
End Sub

Mike
 
T

The Message

Thanks Mike, I knew it would be something simple like that but very
inexperienced at Macro's so normally need help. Thanks a lot!
 

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

Top