Addressing cells without selecting

  • Thread starter Thread starter Robert Christie
  • Start date Start date
R

Robert Christie

Hi everyone
I'm trying to find the last cell of data in Column B,
offset 1 row down and 1 column left, then resize down 200
rows in column A and clearcontents.
My attempt so far, selects all cells from A2 down 200
rows past the last cell in Column B.
I'm trying to achieve this without selecting ranges.
Code so far;

With ActiveSheet
Range("B2", .Cells(.Rows.Count, "B").End(xlUp).Offset(1, -
1).Resize(200, 1)).Select
End With

Note!! "Select" is in code just for testing.

TIA

Regards Bob C.
 
Hi
is this what you're looking for??
With ActiveSheet
Range("B2", .Cells(.Rows.Count, "B").End(xlUp).Offset(1, -
1).Resize(200, 1)).Clearcontents
End With
 
Hi Bob

Try this one instead:

With ActiveSheet
.Cells(.Rows.Count, "B").End(xlUp). _
Offset(1, -1).Resize(200, 1).ClearContents
End With
 
Try the following. Correct for wordwrap.

With ActiveSheet
..Range("B" & .Rows.Count).End(xlUp).Offset(1, -1).Resize
(200, 1).ClearContents
End With

Regards,
Greg
 
Hi
not quite sure but maybe you're looking for this?
With ActiveSheet
Cells(.Rows.Count, "B").End(xlUp).Offset(1, -
1).Resize(200, 1).Clearcontents
End With
 
A big thankyou to Frank, Leo & Greg.
I'll get on top of this VBA sometime, if I live long
enough.

Thanks again

Regards Bob C.
 

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

Back
Top