Copy to

R

Robert

Hello,

Further to my previous post I am again stucked with a command.
With the below statement I want to copy certain lines to a different
sheet, but as I have to use this statement a couple of times.
Therefore I would like to be flexible in choosing the cell to which I
would like to copy the selected lines.

In the current statement all results are copied to column G so in case
of multiple selections the system will overwrite the date in cell G1.
Can anyone advice how to adjust this statement in order to get all
values past starting in cell G20?

Hope it makes sense;-)

Thanks very much!!

Rgds,
robert

'Subtract: RNFH, PRIVATE LOANS (i=b)
Dim bLastRow As Long, bNextRow As Long
Dim b As Long
With Worksheets("Cut-Out")
bLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For b = 1 To bLastRow
If .Cells(b, "A").Value = "RNFH" Then
bNextRow = bNextRow + 1
.Cells(b, "A").Resize(, 28).Copy _
Worksheets("BarraFormat").Cells(aNextRow, "G")
End If
Next b

End With
 
J

john

not sure if I have fully understood you but following correction to your code
should paste results in col G Row 20 onward:

'Subtract: RNFH, PRIVATE LOANS (i=b)
Dim bLastRow As Long, bNextRow As Long
Dim b As Long
bNextRow = 20
With Worksheets("Cut-Out")
bLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For b = 1 To bLastRow
If .Cells(b, "A").Value = "RNFH" Then
.Cells(b, "A").Resize(, 28).Copy _
Worksheets("BarraFormat").Cells(bNextRow, "G")
bNextRow = bNextRow + 1
End If
Next b
End With
 

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