Actuarial Outpost
Go Back   Actuarial Outpost > Actuarial Discussion Forum > Software & Technology
FlashChat Actuarial Discussion Preliminary Exams CAS/SOA Exams Cyberchat Around the World Suggestions

DW Simpson International Actuarial Jobs
Canada  Asia  Australia  Bermuda  Latin America  Europe

Thread Tools Search this Thread Display Modes
Old 09-11-2018, 06:55 PM
DeepPurple's Avatar
DeepPurple DeepPurple is offline
Join Date: Jun 2004
Posts: 4,333

Sub RegroupNHide()
'Ungroup any columns
On Error GoTo group ' if no grouped cols, don't error out; just group and hide

Columns("A:AAA").Select 'Assume colums used will never exceed col ZZ
Selection.EntireColumn.Hidden = False ' Hidden columns must be unhidden to ungroup
Selection.Columns.Ungroup ' Hidden columns must be unhidden to ungroup

group: On Error GoTo out

Dim colcount As Integer: colcount = 0

colcount = Application.WorksheetFunction.CountA(Range("C7:AAA 7")) ' first row of data is row 7
Range(Columns(3), Columns(colcount + 1)).Select
Selection.EntireColumn.Hidden = True

out: End Sub
Come on. Let's go space truckin'. Come on!
Reply With Quote

excel, vba

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 05:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
*PLEASE NOTE: Posts are not checked for accuracy, and do not
represent the views of the Actuarial Outpost or its sponsors.
Page generated in 0.10666 seconds with 11 queries