Soru Macro ile VLookUp çalışması

Tores333

Altın Üye
Katılım
26 Ocak 2017
Mesajlar
36
Excel Vers. ve Dili
Microsoft 365 EN 64 bit
Altın Üyelik Bitiş Tarihi
23-06-2025
merhaba,

VlookUp formulunu bir türlü kendi dosyamda kullanamadım. yardımınızı rica ederim.
örnek dosyalara uyarlama yaptı.

A dosyasındaki F sutunundaki değere göre G sutununa, B dosyasındaki belirledigim tablodaki eslestirmeyi getirmesini istiyorum.

bircok kombinasyon denedim ama formul kısmında hata yapıyorum. aşağıdaki verdigim kodu kullandım, Formul olan yere VlookUp sonucu gelmeli.

Kod:
Sub Convert_Trade()

Dim Trades As Integer

Application.ScreenUpdating = False
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False



For Trades = 1 To 4000
    Cells(Trades, 7).Select
    If Selection.Offset(0, -1).Value = "" Then
        Selection.Value = ""
        
    ElseIf Selection.Offset(0, -1).Value = "UNLOC" Then
        Selection.Value = "Trade"
        
    ElseIf Selection.Offset(0, -1).Value = "POD" Then
        Selection.Value = "Area"
        
    Else
        Selection.Value = Formul
    
'kullanılan formul =VLOOKUP(F1,'[B.xlsx]DATA'!$A$1:$B$790,2,FALSE)


    End If
Next Trades


Application.ScreenUpdating = True
Application.EnableEvents = True
ActiveSheet.DisplayPageBreaks = True
Application.CutCopyMode = False

End Sub

Tesekkurler
 

Ekli dosyalar

  • 8.7 KB Görüntüleme: 3
  • 8.5 KB Görüntüleme: 4

Muzaffer Ali

Destek Ekibi
Destek Ekibi
Katılım
5 Haziran 2006
Mesajlar
6,165
Excel Vers. ve Dili
2019 Türkçe
Merhaba.
Kod:
Sub Convert_Trade()
    Dim Bak As Integer
    Application.ScreenUpdating = False
    For Bak = 1 To Cells(Rows.Count, "F").End(xlUp).Row
        Select Case Cells(Bak, "F").Value
            Case ""
                Cells(Bak, "G").Value = ""
            Case "UNLOC"
                Cells(Bak, "G") = "Trade"
            Case "POD"
                Cells(Bak, "G") = "Area"
            Case Else
                Cells(Bak, "G") = WorksheetFunction.VLookup(Cells(Bak, "F"), Workbooks("B.xlsx").Worksheets("DATA").Range("A:B"), 2, 0)
        End Select
    Next
    Application.ScreenUpdating = True
End Sub
 
Üst