I am trying to create a macro for sending emails from outlook. I have few edits to be done with the raw data for that i have given codes.
Since im new to VBA i do not know how to use the Vlookup function and also im not very well versed in using vlookup in excel too :( I am trying to get the data from Master data(Sheet name)-Col A has Account & Col B has values. I want code to get the values of Col B if Col A in there in the Email output sheet.
Master Data sample
Account Value
803 A
691 B
8010 C
I want to copy the values in the col I of the Email output sheet if the account number matches in the Col A.Can you help?
Col A Col I
Account Value
803 Copy values from Master data depending on Account Value
691 Copy values from Master data depending on Account Value
8010 Copy values from Master data depending on Account Value
Here is my code, Im trying not use default VLOOKUP Function on vba, but use a logic behind that function to know how VLOOKUP works
With Sheets("Master Data")
i1 = 2
Do While Sheets("Email Output").Cells(i1, 1).Value <> vbNullString
i2 = 2
Do While .Cells(i2, 1).Value <> vbNullString
If Sheets("Email Output").Cells(i1, 1).Value = .Cells(i2, 1).Value Then
Sheets("Email Output").Cells(i1, 2).Value = .Cells(i2, 2).Value
Exit Do
End If
i2 = i2 + 1
Loop
i1 = i1 + 1
Loop
End With
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.