I am working on VBA code that will run through a dropdown menu in Sheet "voorblad".
For every value in the dropdown menu I want to copy the value "Voorblad".range"K9" and "Calculation".range"G35" and paste it in a sheet called "LIST Sheet".
The VBA is meant to create a list of all the values.
Sub CreateList()
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Validation message!", vbYesNoCancel, "CreateList")
If Answer = vbYes Then
Application.ScreenUpdating = False
With Sheets("Voorblad").Range("K9").Validation
For Each rCell In Range(.Formula1)
.Parent.Value = rCell.Value
Sheets("Voorblad").Select
Range("K9").Select
ActiveCell.Copy
Sheets("LIST Sheet").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlPasteValues
Sheets("LIST Sheet").Select
ActiveCell.Offset(1, 0).Select
Sheets("Calculation").Select
Range("G35").Select
ActiveCell.Copy
Sheets("LIST Sheet").Select
Range("G2").Select
Selection.PasteSpecial Paste:=xlPasteValues
Sheets("LIST Sheet").Select
ActiveCell.Offset(1, 0).Select
Next rCell
.Parent.Value = ""
End With
Application.ScreenUpdating = True
MsgBox "Export geslaagd! Het PDF is opgeslagen in jouw Documenten"
End If
End Sub
The VBA code is not creating a list. Every time the macro runs through the code it will reselect the pre-selected cells at Range("B2") and Range("G2"). I want it to paste the values one row down. Eventually this must create a list.
Sheets("Calculation").Range("G35").Copy
insted of selecting sheet, cell, then copying cell – Cyril