I havComparing two columns and get the resulte three columns

Answered

Hi!

I have problem coding between two columns and third with result

Let’s say

Column E = Destination

Column F=ORIGIN

And Column G Should contain RP/ARRIVAL

Or SPOT TIME It depends from the destination

 

Thank you!

Top Contributor Asked on November 18, 2017 in VBA: Basics.
Add Comment
12 Answer(s)
Best answer

You can create similar file with dummy data I don’t think it is difficult

Can you point to the line that the error occurs at?

Expert Answered on November 18, 2017.

Yes!! I’ll try dummy I think it’s going to be more easy to get what I need! Thanks!!! 🙂

on November 18, 2017.
Add Comment

Hello

Can you give more details and attach sample of your workbook with some desired output?

Expert Answered on November 18, 2017.
Add Comment

Column  E is Origin

Column F is Destination

Column G may be RP TIME/SPOT TIME/TMR RELEASE

G depends of which is the origin and what I have to track.

Let’s say

Origin=Kuwait

Destination=Macedonia

G should be RP TIME

Or if

Origin = Macedonia

Destination=Majami

G should be SPOT TIME

I hope am easy to understand now 🙂

Top Contributor Answered on November 18, 2017.
Add Comment

And thank you! 🙂

Top Contributor Answered on November 18, 2017.
Add Comment

Try this code

Sub Test()
Dim i As Long
Dim m As Long
m = Cells(Rows.Count, 5).End(xlUp).Row
For i = 2 To m '2 First Row Of Data. I Supposed Row 1 For Headers
If Cells(i, 5) = "Kuwait" And Cells(i, 6) = "Macedonia" Then
Cells(i, 7) = "RP TIME"
ElseIf Cells(i, 5) = "Macedonia" And Cells(i, 6) = "Majami" Then
Cells(i, 7) = "SPOT TIME"
Else
Cells(i, 7) = ""
End If
Next i
End Sub
Expert Answered on November 18, 2017.
Add Comment

Thank you!! I will and I’ll let you know 🙂

Top Contributor Answered on November 18, 2017.
Add Comment

You’re welcome

Glad I can offer some help

Expert Answered on November 18, 2017.
Add Comment

Thank you! It runs, Ill try some others stuff that I need to add for matching, but I have another problem now, I had a diffrent code I set the macro to run whenever I open the work book but now it gives me error of function or variable on my mobule 🙁 so I have to run it manual

Top Contributor Answered on November 18, 2017.
Add Comment

You’re welcome

It will be better to upload sample of your workbook to see the error ..

Try to declare all the variables in your codes so as to avoid errors

Expert Answered on November 18, 2017.
Add Comment

I cannot upload a file, at least I don’t see permission for that 🙂

Top Contributor Answered on November 18, 2017.
Add Comment

I can’t help you anymore. Hope you can find the cause of error on your own

Expert Answered on November 18, 2017.
Add Comment

I am trying dummy now so I hope I’ll get what I need. Thanks!!

Top Contributor Answered on November 18, 2017.
Add Comment
  • Found this useful?

    Please share using the share button above.

    If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.

    Found the answer useful and wants to credit the user, then vote the answer (vote up).

  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.