[英]Excel macro add a cell value in a different worksheet based on a specific cell value in the first sheet
嗨,我需要有人來幫助我在Excel 2007上進行這種情況:)
所以這是場景:
單擊commandButton1后,
因此,每當我輸入另一個代碼,例如QZ0822(sheet1),然后單擊按鈕后,它將自動在包含QZ0822(sheet2)的單元格旁邊添加“確定”。
我可以這樣做嗎?
這樣的東西?
Sub lookup()
Dim strSearch As String
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Set wks1 = Sheets("Your Sheet 1") '<--- fill in your sheet name
Set wks2 = Sheets("Your Sheet 2") '<--- fill in your sheet name
strSearch = wks1.Range("B3").Value
With wks2
.Columns(2).Find(strSearch).Offset(0, 1).Value = "Ok"
End With
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.