ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional assignment? (https://www.excelbanter.com/excel-programming/416437-conditional-assignment.html)

Maury Markowitz[_2_]

Conditional assignment?
 
I can't believe this hasn't come up in my code before...

Does VBA have a conditional assignment function? Like...

msg = (user = "Maury") ? "Foo" : "Bar"

Maury

Jim Thomlinson

Conditional assignment?
 
Nothing as concise as that but you can use iif instead of if
--
HTH...

Jim Thomlinson


"Maury Markowitz" wrote:

I can't believe this hasn't come up in my code before...

Does VBA have a conditional assignment function? Like...

msg = (user = "Maury") ? "Foo" : "Bar"

Maury



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com