Count visible columns

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,480
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
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

JLeno

Board Regular
Joined
Mar 8, 2012
Messages
234
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?
 

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,480
Works perfectly!!

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

Watch MrExcel Video

Forum statistics

Threads
1,123,259
Messages
5,600,574
Members
414,390
Latest member
plimbu

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
Top