Bomino
Member
Hi everyone,
I need help troubleshooting my code or better yet help with a more efficient solution.
I wrote a code and it seems not to be doing what it is supposed to do: pulling data from a worksheet (Data) and populate a column in another worksheet (Main) based on value from dropdown. Here is my code:
Am I missing something?
Any help will be much appreciated.
Thank you.
I am also attaching a sample file
I need help troubleshooting my code or better yet help with a more efficient solution.
I wrote a code and it seems not to be doing what it is supposed to do: pulling data from a worksheet (Data) and populate a column in another worksheet (Main) based on value from dropdown. Here is my code:
Code:
Sub Retrieval()
Dim x As Variant, y As Variant
Dim RptDate As Range
With Application
.EnableEvents = False
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Lastrow = DATA.Cells(Rows.Count, 1).End(xlUp).Row
y = 18
For x = 6 To Lastrow
If DATA.Cells(x, 2) = MAIN.Cells(2, 8) And DATA.Cells(x, 3) = MAIN.Cells(y, 6) Then
MAIN.Cells(y, 13) = DATA.Cells(x, 10)
y = y + 1
End If
Next
With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Any help will be much appreciated.
Thank you.
I am also attaching a sample file