deleting a range

N

NDBC

Could you please tel me why this wouldn't work

Sheets("a lap").Range(Cells(Target.Row, MaxCol + 4), Cells(Target.Row, _
256)).ClearContents

I'm running it from some code in a sheet called A grade if that makes a
difference.
Maxcol is dim as integer.

Thanks
 
M

Mike H

Hi,

You don't say how your setting target.row or maxcol and I think you may mean
activecell.row instead of target .row, try this

maxcol = 5
Sheets("a lap").Range(Sheets("a lap").Cells(ActiveCell.Row, maxcol + 4),
Sheets("a lap").Cells(ActiveCell.Row, 256)).ClearContents

Note I've manually set maxcol.

Mike
 
K

Kevin Smith

what have you Dim'ed Target as?

Also could you post a bit more of the code so i can see where the values are
being set.
 
N

NDBC

Mike thanks, worked a treat. The target.row part was fine, just needed the
extra sheets("a lap").cells..... in the range part of the statement.
 

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