2013-10-03 5 views

답변

2

왜 매크로를 사용합니까?

[BF2] =IF($H$1=B2; N2; "") 
[H2] =BF2 
0

이 코드는 B 열의 각 셀을 같은 시트의 셀 H1에 저장된 값으로 검사합니다. 값이이 열 "N"값으로 열 BF에서 (행에 의해) 풀어서 셀을 채울 것입니다 일치하는 경우 :

Sub CompareValues() 
Dim Wks as Worksheet: Set Wks = Sheets("YourWorkSheetName") 
    ' in this worksheet the code will do the lookup and copy values 
Dim Wks2 as Worksheet: Set Wks2 = Sheets("YourOtherWorkSheetName") 
    ' in this sheet (2) the code will optionally copy the values 
CompareValue = Wks.Range("H1").value 
    Dim I as integer 
    for i = 1 to 10000 ' you can set a smaller value thow 
     If Wks.Range("B"&i) = CompareValue then 
     Wks.Range("BF"&i).Value = Wks.Range("N"&i) 
     ' to fill the value into another sheet simply replace the Wks with Wks2 
     ' Wks2.Range("BF"&i) = = Wks.Range("N"&i) 
     end if 
    next i 
End Sub 

희망을 은 그냥 시트 이름을 입력하고 결국 (10000) 작은 행 수를 설정 이게 도움이됩니다!