Thread: Last column...
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Last column...

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


Darin Kramer wrote:

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 ***


--

Dave Peterson