[英]Excel macro add a cell value in a different worksheet based on a specific cell value in the first sheet
Click here to see the picture 点击这里查看图片
Hi, I need someone to help me doing this scenario on my Excel 2007 :) 嗨,我需要有人来帮助我在Excel 2007上进行这种情况:)
So here is the scenario : 所以这是场景:
After the commandButton1 is clicked , 单击commandButton1后,
So whenever I input another code , for example QZ0822 (sheet1), then after I click the button, it will automatically add “Ok” next to cell that contains QZ0822 (sheet2). 因此,每当我输入另一个代码,例如QZ0822(sheet1),然后单击按钮后,它将自动在包含QZ0822(sheet2)的单元格旁边添加“确定”。
Is it possible for me to do that? 我可以这样做吗?
Somehting like this? 这样的东西?
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.