ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba for find last column with hidden columns in worksheet (https://www.excelbanter.com/excel-programming/436908-vba-find-last-column-hidden-columns-worksheet.html)

OffDev

vba for find last column with hidden columns in worksheet
 
Hello,

This code has worked for finding the last column:
lc = ws.cells(7, columns.count).end(xltoleft).column.

However, when I used this code for a sheet that has hidden columns it would
not work.

What would be the correct code in this instance?

Please assist.

Thanks from OffDev wannabe

Mike H

vba for find last column with hidden columns in worksheet
 
Hi,

lc = Rows(7).Find(What:="*", SearchDirection:=xlPrevious).Column

Mike

"OffDev" wrote:

Hello,

This code has worked for finding the last column:
lc = ws.cells(7, columns.count).end(xltoleft).column.

However, when I used this code for a sheet that has hidden columns it would
not work.

What would be the correct code in this instance?

Please assist.

Thanks from OffDev wannabe



All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com