View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default how to count the number of occupied columns in a sheet?

Hi Mark,

Try:

LastCol = Cells(1, Columns.Count).End(xlToLeft).Column


---
Regards,
Norman



"Mark Stephens" wrote in message
...
I know how to count rows:

lgLastRow = Workbooks(2).Sheets(pbFundSheetNo).Cells(Rows.Coun t,
"A").End(xlUp).Row

Can the same code be adapted to count the number of used columns?

Thanks, Mark