View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default VBA quick help from a newbie

try either

Sub selectlast2emptycolumns() 'two ways

'x = Cells(5, Columns.Count).End(xlToLeft).Address
'Range(x).Offset(0, 1).Resize(1, 2).EntireColumn.Select

x = Cells(5, Columns.Count).End(xlToLeft).Column + 1
Range(Cells(5, x), Cells(5, x + 1)).EntireColumn.Select

End Sub

--
Don Guillett
SalesAid Software

"Nathan Bell" wrote in message
...
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