Synax for two IF conditions in VBA

S

Steven Rosenberg

The expression
=if(D2=D1,C1,"")

fills in the contents of cell C2, with the value if C1.
WHAT is the syntax in VBA for filling-in C2 with C1's
value IF D2-D1, AND E2=E1?

Thanks!

Steven Rosenberg
 
C

Chip Pearson

Steven,

Try something like

If (Range("D1").Value = Range("D2").Value) And _
(Range("E1").Value = Range("E2").Value) Then
Range("C2").Value = Range("C1").Value
Else
' do nothing
End If
 
A

Alan Beban

Chip Pearson provided a VBA programming solution because you posted in
the . . . programming newsgroup. Did you want

=IF(AND(D1=D2,E1=E2),C1,"")

If so, a similar question in the future might best be posted to the
....worksheet.functions newsgroup.

Alan
Beban
 
S

Steven Rosenberg

Thanks for your help. The first proposal looks more like a macro than
formula; I'll try it, since that was my original hope, several weeks
ago.

The Worksheet function group? A URL?
 
S

Steven Rosenberg

Mr. Pearson:

Thanks your your answer. But how do I make that code
work all the way down a column?

Steven Rosenberg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top