Option Explicit
Sub test()
Dim str As String
With ThisWorkbook.Worksheets("Sheet1")
str = Application.Clean(Application.Trim(.Range("A1").Value))
'Copy A1 value to A2
.Range("A2").Value = str
'Use A1 value as message on message box
MsgBox str
'Use A1 value as data validation on A2
With Range("A2").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=str
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
End With
End Sub
1 回答
由于解释的幸运,使用下面的代码,您可以将单元格值复制到另一个单元格 . 通过代码修改,您可能会获得所需的收入 .
尝试: