#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"