Come posso esprimere la condizione "se il valore non è vuoto" nel linguaggio VBA? È qualcosa del genere?
"if value is not empty then..."
Edit/Delete Message
Prova questo:
If Len(vValue & vbNullString) > 0 Then
' we have a non-Null and non-empty String value
doSomething()
Else
' We have a Null or empty string value
doSomethingElse()
End If
Non sono sicuro che questo sia quello che stai cercando
if var<>"" then
dosomething
o
if isempty(thisworkbook.sheets("sheet1").range("a1").value)= false then
si può usare anche la funzione ISEMPTY
Il suggerimento di Alexphi è buono. Puoi anche fare un hard code creando prima una variabile come Variante
e poi assegnandola a Empty
. Poi fai un if/then con per eventualmente riempirla. Se viene riempita, non è vuota, se non lo fa, rimane vuota. Si controlla poi con IsEmpty
.
Sub TestforEmpty()
Dim dt As Variant
dt = Empty
Dim today As Date
today = Date
If today = Date Then
dt = today
End If
If IsEmpty(dt) Then
MsgBox "It not is today"
Else
MsgBox "It is today"
End If
End Sub