Salcybercat
New Member
- Joined
- Sep 29, 2011
- Messages
- 4
Hey guys, need help on a very length code I'm using Excel 2007.
The way I programmed my Excel spreadsheet is: specific columns in a different worksheet ('Table') are hidden/shown according to answers in cells in worksheet 'Questions'.
The code I included below is just a snippet of the whole Worksheet_Calculate(). It goes all the way to column FQ, so you can imagine how slow the program runs
Any suggestions on how to shorten the process?? Help is much appreciated!
The way I programmed my Excel spreadsheet is: specific columns in a different worksheet ('Table') are hidden/shown according to answers in cells in worksheet 'Questions'.
The code I included below is just a snippet of the whole Worksheet_Calculate(). It goes all the way to column FQ, so you can imagine how slow the program runs
Code:
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
If Range("E32").Value = 0 Then
Sheets("Table").Columns("Z").EntireColumn.Hidden = True
Else
Sheets("Table").Columns("Z").EntireColumn.Hidden = False
End If
If Range("F32").Value = 0 Then
Sheets("Table").Columns("AA").EntireColumn.Hidden = True
Else
Sheets("Table").Columns("AA").EntireColumn.Hidden = False
End If
If Range("G32").Value = 0 Then
Sheets("Table").Columns("AB").EntireColumn.Hidden = True
Else
Sheets("Table").Columns("AB").EntireColumn.Hidden = False
End If
Any suggestions on how to shorten the process?? Help is much appreciated!