Macro - issue with positioning results

T

The Message

With the help of the online Microsoft team they have provided me with the
following Macro which is transferring data from Sheet 1 to Sheet 3. All I
need to do is display this data from Cell A8 onwards. At present the Macro is
copying everything onto sheet 3 from cell A1 onwards, which is not allowing
me to put any column titles in place. Can you help?

Sub Risks()
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
 
H

Homey

one change do it i think

For lngRow = 8 To Cells(Rows.Count, "A").End(xlUp).Row

| With the help of the online Microsoft team they have provided me with the
| following Macro which is transferring data from Sheet 1 to Sheet 3. All I
| need to do is display this data from Cell A8 onwards. At present the Macro
is
| copying everything onto sheet 3 from cell A1 onwards, which is not
allowing
| me to put any column titles in place. Can you help?
|
| Sub Risks()
| 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
 
T

The Message

Thanks for that Homey, but I'm afriad that change simply puts rows 8,9 and 10
into Rows 1,2,&3 on sheet 3
 
G

Gord Dibben

lngNRow = lngNRow + 1: Rows(lngRow).Copy ws.Rows(lngNRow + 7)

Will put rows 1:10 from Sheet1 into rows 8:17 in Sheet3


Gord Dibben MS Excel MVP
 

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