Last column...

D

Darin Kramer

Hi all,

Im sure ive done this before, but cant get it to work now!

I want to find the last column (ie start at IJ go left until find last
column with data in it. I then want to delete from IJ up to 1 + the last
column!

Any ideas ?

Thanks

D

Ps - Dave the one for rows works great!



*** Sent via Developersdex http://www.developersdex.com ***
 
D

Dave Peterson

Can you pick out a row that always has data in it if that column is used?

I used row 1:

Dim NextCol As Long
With ActiveSheet
NextCol = .Cells(1, .Columns.Count).End(xlToLeft).Column + 1
.Range(.Columns(NextCol), .Columns(.Columns.Count)).EntireColumn.Delete
End With

And why end at IJ? I used all the columns (IV in xl2003 and below).

But if you want...

Dim NextCol As Long
With ActiveSheet
NextCol = .Cells(1, "IJ").End(xlToLeft).Column + 1
.Range(.Columns(NextCol), .Columns("IJ:IJ")).EntireColumn.Delete
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

Similar Threads


Top