Count visible columns

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,600
Office Version
  1. 365
Platform
  1. Windows
I am looking for a bit of code that will count the number of visible columns either

I have the following which is missing the code to establish if the range is visible or
Code:
Do Until rngVisibleColumnCount.Column = Range("HRISData_RoleError").Column
'Code to establish if visible
intVisibleColumnCount = intVisibleColumnCount + 1
Set rngVisibleColumnCount = rngVisibleColumnCount.Offset(0, 1)
Loop

Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Code:
Do Until rngVisibleColumnCount.Column = Range("HRISData_RoleError").Column
    If rngVisibleColumnCount.Width > 0 Then
        intVisibleColumnCount = intVisibleColumnCount + 1
    End If
    Set rngVisibleColumnCount = rngVisibleColumnCount.Offset(0, 1)
Loop

Does that work for you?
 
Upvote 0
Works perfectly!!

So simple.....the coffee clearly hasn't kicked in yet!!
 
Upvote 0

Forum statistics

Threads
1,214,576
Messages
6,120,354
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top