I'm working for my internship and have to make a macro in Excel VBA.
Theres one column with vlookups
generated by the macro and the column next to it is what it uses to lookup what it needs from another sheet.
But the thing is, it repeats itself with the same vlookup
over and over and I don't know how or what I can do against it to fix it. So I hoped I could get help from here.
I'm not experienced at all and am basically teaching myself what I know at the moment from VBA Excel.
The code:
Range("H22").Select
Sheets("EplSheet").Select
Range("D3").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=VERT.ZOEKEN(C3;Hulpblad!F:I;4;0)"
Columns("D:D").Select
Selection.TextToColumns Destination:=Range("D1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
Range("D3").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=477
Range("D3:D500").Select
ActiveSheet.Paste
Range("E4").Select
Application.CutCopyMode = False
I know it will most likely be done with a simple loop, like for each time I paste this I add 1 up to the C3
so it goes to C4
, C5
, C6
, etc. but I dont know and can't find out how for 30 min already and don't want to be stuck on this part.
As you can see in this screenshot it repeats itself while the A3 should be going up at the same rate as the left column so every row down it should go 1 up.