Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub search(p_sorszam As Integer, p_sheet As Worksheet, ByVal p_field As String)
  2.     Dim row%, WS As Worksheet
  3.     Set WS = Sheets("IG2KH")
  4.     row% = 3
  5.     p_sheet.Cells(p_sorszam, "B") = "T" & p_field
  6.     Do While WS.Cells(row%, "A") <> ""
  7.         If Cells(row%, "A") = p_field Then
  8.             p_sheet.Cells(p_sorszam, "C") = "P: " & WS.Cells(row%, "D") & ", H: " & WS.Cells(row%, "E")
  9.             Exit Do
  10.         End If
  11.         row% = row% + 1
  12.     Loop
  13. End Sub
  14.  
  15. Sub mm()
  16.     Dim sor%, usor%, WS As Worksheet
  17.     Set WS = Sheets("Sheet1")
  18.     sor% = 3
  19.     usor% = WS.Cells(Rows.Count, "A").End(xlUp).row + 1
  20.     Sheets("IG2KH").Select
  21.     Do While Cells(sor%, "A") <> ""
  22.         If UCase(Left(Cells(sor%, "Q"), 3)) = "E (" Then
  23.             Call search(usor%, WS, Mid(Cells(sor%, "Q"), 5, Len(Cells(sor%, "Q")) - 5))
  24.             WS.Cells(usor%, "A") = "P: " & Cells(sor%, "D") & ", H: " & Cells(sor%, "E")
  25.             usor% = usor% + 1
  26.         End If
  27.         sor% = sor% + 1
  28.     Loop
  29. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement