If statement in macro

P

punter

Hi,

I'm trying to get the formula below to run in my macro. This is a
report I'll be running on a weekly basis and the number of blanks in
column I will change every week. I'm trying to get the macro to apply
the formula at the first blank but I'm having some issues. I've been
kicking around the Dim LastRow as long but I keep getting various error
messages. In a nutshell what I'm looking for is the macro to read the
first blank in column I, then if AE = 7 or 11I want it to poplulate
column I with FedEx Weeky Charge.


=IF(AND(OR(AE2=7,AE2=11),I2=""), "FedEx Weekly Charge", "")

Thanks for all your help.

Eddie
 
D

Dave Peterson

I'm not sure I understand...

But maybe...

Option Explicit
Sub testme()
Dim NextRow As Long

With ActiveSheet
NextRow = .Cells(.Rows.Count, "I").End(xlUp).Row + 1
with .cells(NextRow, "I")
.Formula _
= "=IF(AND(OR(AE2=7,AE2=11),I2=""""),""FedEx Weekly
Charge"","""")"
'.value = .value '????
End With
End Sub
 

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