Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IF ELSE with an AND?

I am trying to write a VBA macro that scans down a column and when
value is lower in cell before and lower in cell after (i.e. at a peak
and a variable is set at specific value that information is then copie
onto another spread sheet.

In old spreadsheet system I used I could put
IF r2c2<r1c2 AND r3c2<r2c2 AND x=yes THEN
"tell it what to do"
END IF

Is there a way in VBA to use AND in an IF...END IF statement?
Or should I be using some other formula

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default IF ELSE with an AND?

Hi
something like
if range("B2").value<range("B1").value and _
x="yes" then
'do something
end if

--
Regards
Frank Kabel
Frankfurt, Germany


I am trying to write a VBA macro that scans down a column and when a
value is lower in cell before and lower in cell after (i.e. at a

peak)
and a variable is set at specific value that information is then
copied onto another spread sheet.

In old spreadsheet system I used I could put
IF r2c2<r1c2 AND r3c2<r2c2 AND x=yes THEN
"tell it what to do"
END IF

Is there a way in VBA to use AND in an IF...END IF statement?
Or should I be using some other formula?


---
Message posted from http://www.ExcelForum.com/


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 04:07 AM.

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

About Us

"It's about Microsoft Excel"