How I edit my code VBA mapping Value and send output to a new column

lotto009

New Member
Joined
Sep 19, 2012
Messages
23
Dear All
How I edit my code VBA mapping Value and send output to a new column
1.Check Input Value Worksheets("sheet1").Range(" J2:J21").Select and
Worksheets("sheet1").Range("B3:D7").Select (Blue)
2.If Worksheets("sheet1").Cell(" J2") = Worksheets("sheet1").Range("B3")
3.Send output Value a tWorksheets("sheet1").Cell(" A3") to Worksheets("sheet1").Range("K2") (Yellow)
4.Send output Value at Worksheets("sheet1").Cell(" B2") to Worksheets("sheet1").Range("L2") (Red)
Please download my file at google drive mapping.xlsm
Best regards
art
VBA Code:
Dim Na As Long, Nc As Long, Ne As Long
    Dim i As Long
    REFER = Worksheets("sheet1").Cells(Rows.Count, "J").End(xlUp).Row
    Nc = Worksheets("sheet1").Cells(Rows.Count, "A").End(xlUp).Row
    Ne = 1

    For i = 2 To REFER
        For j = 1 To Nc
            'If REFER = Nc Then Skip
            If Worksheets("sheet1").Cells(j, "J").Value = Worksheets("sheet1").Cells(i, "A").Value Then
                Exit For
            End If
        Next j
        If (j - 1) = Nc Then
            Worksheets("sheet1").Cells(Ne, "K").Value = Worksheets("sheet1").Cells(i, "A").Value
            Ne = Ne + 1
        End If
        
    Next i
 

Attachments

  • mapping value.PNG
    mapping value.PNG
    123.6 KB · Views: 16

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How about
VBA Code:
Sub lotto()
   Dim Cl As Range, Rng As Range, Fnd As Range
   
   With Sheets("Sheet1")
      Set Rng = .Range("B3:D" & .Range("B" & Rows.Count).End(xlUp))
      For Each Cl In .Range("J2", .Range("J" & Rows.Count).End(xlUp))
         Set Fnd = Rng.Find(Cl.Value, , , xlWhole, , , , , False)
         If Not Fnd Is Nothing Then
            Cl.Offset(, 1).Value = .Cells(Fnd.Row, 1)
            Cl.Offset(, 2).Value = .Cells(2, Fnd.Column)
         End If
      Next Cl
   End With
End Sub
 
Upvote 0
HOOOO Thank you for Fluff is work very well for m I struck many days
Take care to you and family
Best regards
art
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top