itisananas
New Member
- Joined
- Jul 12, 2021
- Messages
- 9
- Office Version
- 365
- 2016
- Platform
- Windows
Hey people!I came here againg to ask for your help.
So my goal is to make a button and link the button press with the macro NieuweVersieKaartBe.
The goal from the macro is to copy current sheet and paste it into another and then just update the names Be V(number).
Is there a easier way to change the Be V2 to a value from a cell. So That it can read Be V2 or Be V3 from a cell instead.
Sheets("Be V2").Select
If you are wondering why there are numbers from 10 to 2. Thats a sertain value i linked to the amount of Be V# versions that are already made
EDIT: sorry i forgot to add MacroBeV2/3
So my goal is to make a button and link the button press with the macro NieuweVersieKaartBe.
The goal from the macro is to copy current sheet and paste it into another and then just update the names Be V(number).
Is there a easier way to change the Be V2 to a value from a cell. So That it can read Be V2 or Be V3 from a cell instead.
Sheets("Be V2").Select
If you are wondering why there are numbers from 10 to 2. Thats a sertain value i linked to the amount of Be V# versions that are already made
VBA Code:
Sub NieuweVersieKaartBe()
'Dit moet de Controllekaarten versies verversen alleen werkt het nog niet echt
TabbladenTeller
'Alle Berekeningen in Excel uitzetten
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
'Hier komt een venster met een bevestiging voor het aan maken van een nieuwe nummer
Dim answer As Integer
answer = MsgBox("Door op 'ja' te klikken wordt er een nieuwe versie nr. aangemaakt", vbQuestion + vbYesNo + vbDefaultButton2, "Aanvraag nieuwe Versie nr.")
'als het antwoord Ja is op de venster maak dan nieuwe versie aan
If answer = vbYes Then
With Sheets("Controllekaarten Versie Teller").Range("G4")
If .Value = 10 Then
ElseIf .Value = 9 Then
ElseIf .Value = 8 Then
ElseIf .Value = 7 Then
ElseIf .Value = 6 Then
ElseIf .Value = 5 Then
ElseIf .Value = 4 Then
ElseIf .Value = 3 Then
Sheets("Be V2").Select
ActiveSheet.Name = "Be V3"
Sheets("Be V3").Copy Before:=Sheets("Be V3")
ActiveSheet.Name = "Be V2"
MacroBeV3
With Sheets("Be V2").Range("F1066")
Sheets("Be V2").Select
If .Value > 0 Then
Sheets("Be V2").Range("A" & .Value).Select
End If
Selection.Value = "x"
End With
Sheets("Be V3").Select
Sheets("Be V3").Range("A22:A1021").Clear
Range("A19").Select
MsgBox "Be V3 is aangemaakt"
ElseIf .Value = 2 Then
Sheets("Be V1").Select
ActiveSheet.Name = "Be V2"
Sheets("Be V2").Copy Before:=Sheets("Be V2")
ActiveSheet.Name = "Be V1"
MacroBeV2
With Sheets("Be V1").Range("F1066")
Sheets("Be V1").Select
If .Value > 0 Then
Sheets("Be V1").Range("A" & .Value).Select
End If
Selection.Value = "x"
End With
Sheets("Be V2").Select
Sheets("Be V2").Range("A22:A1021").Clear
Range("A19").Select
MsgBox "Be V2 is aangemaakt"
End If
End With
'als het antwoord NEE is op de venster dan annuleer deze aanvraag
ElseIf answer = vbNo Then
MsgBox "Aanvraag is geannulleerd"
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.EnableEvents = True
ActiveSheet.DisplayPageBreaks = True
End Sub
EDIT: sorry i forgot to add MacroBeV2/3
VBA Code:
Sub MacroBeV2()
'
' MacroBeV2
'
'
Sheets("Be V1").Select
Range("B1024:B1063").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Be V2").Select
Range("B22").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
VBA Code:
Sub MacroBeV3()
'
' MacroBeV3
'
'
Sheets("Be V2").Select
Range("B1024:B1063").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Be V3").Select
Range("B22").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub