ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if then vba (https://www.excelbanter.com/excel-programming/279350-if-then-vba.html)

tegger

if then vba
 
What's the correct syntax for this (in vba)?
Sub testifthen()
if cells(1,1).value = "x" and if cells(2,1).value = "y" and if
cells(3,1).value = "z" then cells(4,1).value = "dinner's in the fridge"

End Sub



Ron de Bruin

if then vba
 
Try this

If Cells(1, 1).Value = "x" And Cells(2, 1).Value = "y" _
And Cells(3, 1).Value = "z" Then Cells(4, 1).Value = "dinner's in the fridge"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"tegger" wrote in message ...
What's the correct syntax for this (in vba)?
Sub testifthen()
if cells(1,1).value = "x" and if cells(2,1).value = "y" and if
cells(3,1).value = "z" then cells(4,1).value = "dinner's in the fridge"

End Sub






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

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