C
Claus
Hi
I'm doing a calculation-program for the building industry.
I'll end up with aprox. 15 sheets in my UI.
12 of them are very much alike, but have different numbers of rows (collums
are always the same).
I've made a kind of drawers system using togglebuttons, so the user can
"open" headlines by clicking the apropriate togglebutton, thus showing the
rows that make up the sum in the headline.
So far i've added the togglebuttons manually including code like this on
every sheet:
Private Sub ToggleButton0503_Click()
Call Togglebutton_Klik(Me.ToggleButton0503)
End Sub
And in Module1
Public Sub Togglebutton_Klik(M)
Dim StartRakke As String
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
Call AabenArk 'Unprotect sheet
StartRakke = M.LinkedCell
If M.Value = True Then
Call VisRakke(StartRakke) 'Show rows using column 1
Else
Call SkjulRakke(StartRakke) 'Hide rows using column 1
End If
Call BeskytArk 'Protect sheet
Application.ScreenUpdating = True
End Sub
It works, Ta Da
BUT:
Is there an easier way to make all these buttons by code ?
They will have be on the right line (Collum 1 is hidden and used as a level
indicator (headline or subline))
Can it be done on Workbook_Open, so that a superuser could add new content
without buttons, and then reopen the workbook, so that the Workbook_Open
adds the nessesary buttons ?
I have some experiense in VBA (self made) and is a superuser in Excel.
We use Excel 2002.
Hoping for an answer
Claus Persson
I'm doing a calculation-program for the building industry.
I'll end up with aprox. 15 sheets in my UI.
12 of them are very much alike, but have different numbers of rows (collums
are always the same).
I've made a kind of drawers system using togglebuttons, so the user can
"open" headlines by clicking the apropriate togglebutton, thus showing the
rows that make up the sum in the headline.
So far i've added the togglebuttons manually including code like this on
every sheet:
Private Sub ToggleButton0503_Click()
Call Togglebutton_Klik(Me.ToggleButton0503)
End Sub
And in Module1
Public Sub Togglebutton_Klik(M)
Dim StartRakke As String
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
Call AabenArk 'Unprotect sheet
StartRakke = M.LinkedCell
If M.Value = True Then
Call VisRakke(StartRakke) 'Show rows using column 1
Else
Call SkjulRakke(StartRakke) 'Hide rows using column 1
End If
Call BeskytArk 'Protect sheet
Application.ScreenUpdating = True
End Sub
It works, Ta Da
BUT:
Is there an easier way to make all these buttons by code ?
They will have be on the right line (Collum 1 is hidden and used as a level
indicator (headline or subline))
Can it be done on Workbook_Open, so that a superuser could add new content
without buttons, and then reopen the workbook, so that the Workbook_Open
adds the nessesary buttons ?
I have some experiense in VBA (self made) and is a superuser in Excel.
We use Excel 2002.
Hoping for an answer
Claus Persson