View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default VBA quick help from a newbie

Nathan

Try this

Sub FindLastColumn()

Dim rFound As Range

Set rFound = Sheet1.Cells.Find("*", Sheet1.Cells(1, 1), , , xlByColumns,
xlPrevious)

rFound.Offset(0, 1).Resize(1, 2).EntireColumn.Select

End Sub

--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

Nathan Bell wrote:
All,

I am trying to determine the code to select the 2 last empty
columns in Excel via VBA. The only code I can find is
Range("IV5").End(xlToLeft).Select the only reason for that is row 5
contains data and 1-4 don't, thus returning results further left than
I wanted when doing a paste.

Again I am trying to select the last 2 empty columns in a worksheet.
What would be the most effective way to do this?

Regards,

Nathan