我尝试if lcase(Range("B5").Value) = "active" then
select case ucase(nationality)
case "DT", "AT", "CH"
With ActiveWorkbook.Sheets("PostStayEmail_DE")
Set rng = .Range("A1:B30").SpecialCells(xlCellTypeVisible)
'do something
End With
case "IT"
With ActiveWorkbook.Sheets("PostStayEmail_IT")
Set rng = .Range("A1:B30").SpecialCells(xlCellTypeVisible)
'do something
End With
case else
'do thing if no matches
end select
else
'do stuff when B5 is not 'Active'
end if
,如果SELECT
='',那么我希望结果返回为{{1} }}
例如:
CurrencyCode
可以吗?
答案 0 :(得分:5)
使用CASE WHE... THEN... ELSE... END
或NULLIF
SELECT CurrencyCode,
NULLIF(CurrencyCode,''),
CASE
WHEN CurrencyCode = ''
THEN NULL
ELSE CurrencyCode
END
FROM Contract