I have trouble with this macro - help

G

Graham

I don't know how to do this hope you guys can help.


My data starts in cell G9 to G17 going down and sometimes can be different
in length, there is always data in cell H18, on this occasion.

If my data was in G9 to G20 the other data would by in H21.

I've been trying to do a macro to get the data from that cell, to cells C9
to C17.

Thanks in advance
 
A

Andy Brown

I've been trying to do a macro to get the data from that cell, to cells C9

Assuming there's nothing below the G9:G? data, try

Range("G9").Select
Range(Selection, Selection.End(xlDown)).Offset(0, -4).Value = _
Range("G65536").End(xlUp).Offset(1, 1).Value

HTH,
Andy
 
A

Andy Brown

Assuming there's nothing below the G9:G? data ...

At the same time I guess there's a possibility, however slight, that the
G9:G? range might actually be G9:G9. In which case,

If Range("G10") = "" Then
Range("C9") = Range("H10")
Else
Range("G9").Select
Range(Selection, Selection.End(xlDown)).Offset(0, -4).Value = _
Range("G65536").End(xlUp).Offset(1, 1).Value
End If
 

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