Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
punter
 
Posts: n/a
Default If statement in macro


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


--
punter


------------------------------------------------------------------------
punter's Profile: http://www.excelforum.com/member.php...fo&userid=2044
View this thread: http://www.excelforum.com/showthread...hreadid=553220

  #2   Report Post  
Posted to microsoft.public.excel.misc
punter
 
Posts: n/a
Default If statement in macro


Bump.

Thanks


--
punter


------------------------------------------------------------------------
punter's Profile: http://www.excelforum.com/member.php...fo&userid=2044
View this thread: http://www.excelforum.com/showthread...hreadid=553220

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default If statement in macro

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


punter wrote:

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

--
punter

------------------------------------------------------------------------
punter's Profile: http://www.excelforum.com/member.php...fo&userid=2044
View this thread: http://www.excelforum.com/showthread...hreadid=553220


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
punter
 
Posts: n/a
Default If statement in macro


Thanks Dave. I found a work around but your way seems to be much
cleaner and most likely quicker. I'm going to test it in a little bit.


Thanks

Eddie


--
punter


------------------------------------------------------------------------
punter's Profile: http://www.excelforum.com/member.php...fo&userid=2044
View this thread: http://www.excelforum.com/showthread...hreadid=553220

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I insert a macro into a boolean statement Garrett Excel Worksheet Functions 1 December 29th 05 03:46 PM
how to create automatic macro with if statement or similar betatryck_se Excel Discussion (Misc queries) 2 December 14th 05 11:32 AM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
can i use an IF Statement to run a macro? Davidrowland88 Excel Worksheet Functions 2 February 11th 05 12:45 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 03:06 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"