dummy
fun-surfer,
Het bestand is te groot voor ZIP.
Hierbij de aangepaste code voor de macro op Blad "mutatie"
De kolommen L t/m O gaan na de oorspronkelijke actie nu 1 rij omhoog met behoud van de formules en VW-Opmaak.
Private Sub cmdNieuw_Click() 'OK+nieuwe invoer
'Foutmeldingen bij niet ingevulde velden:
If lstBedrijf.Text = "" Then
MsgBox "Voer a.u.b. 'Bedrijfsnaam' in!"
lstBedrijf.SetFocus
Exit Sub
End If
If lstUitnemer.Text = "" Then
MsgBox "Voer a.u.b. 'Gepakt door' in!"
lstUitnemer.SetFocus
Exit Sub
End If
If lstPad.Text = "" Then
MsgBox "Voer a.u.b. de 1e letter van de locatie in!"
lstPad.SetFocus
Exit Sub
End If
If lstVak.Text = "" Then
MsgBox "Voer a.u.b. de 2e letter van de locatie in!"
lstVak.SetFocus
Exit Sub
End If
If lstVerd.Text = "" Then
MsgBox "Voer a.u.b. de verdieping in!"
lstVerd.SetFocus
Exit Sub
End If
If lstDoos.Value = "" Then
MsgBox "Voer a.u.b. het doosnummer in!"
lstDoos.SetFocus
Exit Sub
End If
If lstAanvrager.Text = "" Then
foutNieuw.Show
Exit Sub
End If
'
'De eigenlijke actie:
'
Worksheets("mutaties").Activate
Application.EnableEvents = False
Rows("4").Select
Range("A4", "P4").Select
Selection.Insert shift:=xlDown
Range("A4").Select
Application.EnableEvents = True
With ActiveCell
.Offset(0, 0).Value = lstBedrijf.Text
.Offset(0, 1).Value = lstAanvrager.Text
.Offset(0, 2).Value = lstUitnemer.Text
.Offset(0, 3).Value = txtDatum.Text
.Offset(0, 4).Value = txtDossier.Value
.Offset(0, 5).Value = lstPad.Text
.Offset(0, 6).Value = lstVak.Text
.Offset(0, 7).Value = lstVerd.Value
.Offset(0, 8).Value = lstDoos.Value
End With
Range("N4").Formula = "=RC[-8]&RC[-7]&RC[-6]"
Range("O4").Formula = "=VLOOKUP(RC[-1],R3C12:R751C13,2,0)"
Range("L5:M752").Select
Selection.Cut
Range("L4").Select
ActiveSheet.Paste
Range("A4").Select
Range("O5").Select
Selection.Copy
Range("O4").Select
Selection.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
Range("A4").Select
Unload Me
mutatie_nieuw.Show
End Sub
Private Sub cmdOpslaan_Click() 'OK+nieuw venster
'Foutmeldingen bij niet ingevulde velden:
If lstBedrijf.Text = "" Then
MsgBox "Voer a.u.b. 'Bedrijfsnaam' in!"
lstBedrijf.SetFocus
Exit Sub
End If
If lstUitnemer.Text = "" Then
MsgBox "Voer a.u.b. 'Gepakt door' in!"
lstUitnemer.SetFocus
Exit Sub
End If
If lstPad.Text = "" Then
MsgBox "Voer a.u.b. de 1e letter van de locatie in!"
lstPad.SetFocus
Exit Sub
End If
If lstVak.Text = "" Then
MsgBox "Voer a.u.b. de 2e letter van de locatie in!"
lstVak.SetFocus
Exit Sub
End If
If lstVerd.Text = "" Then
MsgBox "Voer a.u.b. de verdieping in!"
lstVerd.SetFocus
Exit Sub
End If
If lstDoos.Value = "" Then
MsgBox "Voer a.u.b. het doosnummer in!"
lstDoos.SetFocus
Exit Sub
End If
If lstAanvrager.Text = "" Then
foutOpslaan.Show
Exit Sub
End If
'
'De eigenlijke actie:
'
Worksheets("mutaties").Activate
Application.EnableEvents = False
Rows("4").Select
Range("A4", "P4").Select
Selection.Insert shift:=xlDown
Range("A4").Select
Application.EnableEvents = True
With ActiveCell
.Offset(0, 0).Value = lstBedrijf.Text
.Offset(0, 1).Value = lstAanvrager.Text
.Offset(0, 2).Value = lstUitnemer.Text
.Offset(0, 3).Value = txtDatum.Text
.Offset(0, 4).Value = txtDossier.Value
.Offset(0, 5).Value = lstPad.Text
.Offset(0, 6).Value = lstVak.Text
.Offset(0, 7).Value = lstVerd.Value
.Offset(0, 8).Value = lstDoos.Value
End With
Range("N4").Formula = "=RC[-8]&RC[-7]&RC[-6]"
Range("O4").Formula = "=VLOOKUP(RC[-1],R3C12:R751C13,2,0)"
Range("L5:M752").Select
Selection.Cut
Range("L4").Select
ActiveSheet.Paste
Range("A4").Select
Range("O5").Select
Selection.Copy
Range("O4").Select
Selection.PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
Range("A4").Select
Unload Me
End Sub