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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,875
Messages
6,122,042
Members
449,063
Latest member
ak94

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