[英]How to convert a value in Excel cell on one sheet to show as a dropdown in another
這是VBA宏。
它使用Sheet1中的單元格A1和Sheet2中的單元格B9
Sub demo()
Dim r1 As Range, r2 As Range
Set r1 = Sheets("Sheet1").Range("A1")
Set r2 = Sheets("Sheet2").Range("B9")
With r2.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=r1.Value
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
它不是函數,如果A1中的值更改,則必須重新運行該子程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.