写一些难题。
我需要能够有一个空白框,您可以输入一个数字,在另一张纸上的字段中返回“是”或“否”。
所以我希望能够在工作表1的框中输入值,然后在工作表2上找到相应的数字,并将交付的列标记为是。
我可以这样做,但我希望能够在框中重新输入一个数字而不删除第二张上的“是”?
答案 0 :(得分:0)
因此,在要显示“是”的单元格中,执行以下操作:
如果列表中的相应单元格与Sheet1值匹配,则 =If(A1 = Sheet1!$A$1,"Yes","")
将单元格标记为“是”。
然后,在Sheet1中输入数字后,运行以下宏,您可能应该连接到按钮或键盘快捷键:
Sub LockYes()
Dim rCell as Range
Dim rYes as Range
Set rYes = Sheets("Sheet2").Range("B:B") 'This should be the range where you expect "Yes" to appear. Also, for performance reasons, restricting to your actual used range (like "B2:B1000") would be beneficial. There are other places on SO that could help you make this dynamic as well...
For Each rCell in rYes
If rCell.Value = "Yes" Then rCell.Value = rCell.Value 'This will remove the formula and leave the value as a static "Yes"
Next
End Sub