Code:
Sub CollectWorkbook()
'ActiveSheet.Unprotect Password:="*******"
ActiveSheet.Select
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
x = Range("FirstRow").Value
y = Range("FirstCol").Value
Dim currentSheet As String
Cells(x, y).Select
Do While Cells(x, y).Value <> ""
[INDENT]If Cells(x, y).Value = False Then
[INDENT]'1) pick up sheetname from Frontpage
currentSheet = Cells(x, y).Offset(0, 2).Value
'2) select sheet
Worksheets(currentSheet).Select
'ActiveSheet.Unprotect Password:="********"
'3) disable evdre cell
Range("A1").Select
ActiveCell.FormulaR1C1 = Cells(x, y).Offset(0, 3).Value
'ActiveSheet.Protect Password:="*******"
'4) hide selected sheet
ActiveWindow.SelectedSheets.Visible = False
[/INDENT]
End If
[/INDENT]
Worksheets("FrontPage").Select
x = x + 1
Loop
Worksheets("FrontPage").Select
'ActiveSheet.Protect Password:="*****"
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Code:
Sub ResetWorkbook()
'ActiveSheet.Unprotect Password:="******"
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
x = Range("FirstRow").Value
y = Range("FirstCol").Value
Dim hiddenSheet As String
Cells(x, y).Select
Do While Cells(x, y).Value <> ""
[INDENT]
If Cells(x, y).Value = False Then
[INDENT]
'1) pick up sheetname from Frontpage
hiddenSheet = Cells(x, y).Offset(0, 2).Value
'2) Unhide hiddenSheet
Worksheets(hiddenSheet).Visible = True
'3) reset evdre cell
Range("A1").Select
'ActiveSheet.Unprotect Password:="********"
Range("A1").Value = Cells(x, y).Offset(0, 3).Value
'ActiveSheet.Protect Password:="**********"
[/INDENT]
End If
[/INDENT]
Worksheets("FrontPage").Select
x = x + 1
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
'ActiveSheet.Protect Password:="********"
End Sub
De macro's zijn, met hulp van een collega, iets uitgebreider geworden en ietsjes moeilijker.
Feitelijk gezien draain de twee macro's hierboven beiden in hetzelfde vba macro.
De eerste macro hide een aantal sheets die niet zijn aangevinkt in "frontpage".
De tweede macro zou alles weer terug moeten zetten naar de oorspronkelijke staat, waarbij dus alle sheets zijn weergegeven in het werkboek.
Ik loop alleen nog vast op het feit dat de macro een formule moet weghalen die normaal niet door Excel wordt ondersteund, maar door een grote plug-in wel.
De eerste sub haalt wel de formule weg, maar de tweede sub zou de formule weer moeten terugzetten.
Die sub zou namelijk alles weer moeten terugzetten in zijn oude staat. Alleen omdat de formule die in de eerste sub onderbroken is, niet wordt ondersteund door Excel kan de tweede sub er niet een = bij zetten. De rest van de formule wordt wel teruggezet, maar zonder de = aan het begin snapt de plug-in niet dat hij moet gaan draaien.
enige suggesties???