Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to autofill formula in every row

Hello,

I'm attempting to write a macro that will insert a formula starting in
cell "C13", in every row (straight down the C column), to the end of the
range of the spreadsheet.

The formula I want to enter is
"=IF(AND(D13="",E13=""),"",IF(D13="","50","40" ))"

Is there anyone that could kindly help me with this?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to autofill formula in every row

Thank you very much.

Works exactly as needed!


Tom Ogilvy wrote:
set rng1 = Activesheet.UsedRange
Set rng = Range("C13",Cells(rng1(rng1.count).row,"C"))
rng.Formula = "=IF(AND(D13="""",E13=""""),"""",IF(D13="""",50,40 ))"

If you really want the 50 and 40 to be strings

rng.Formula = "=IF(AND(D13="""",E13=""""),"""",IF(D13="""",""50" ",""40""))"


if we could count on column A (as an example) to have a value in the last
row you want to use you could do


Set rng = Range("C13",Cells(Cells(rows.count,1).End(xlup).ro w,"C"))

--
Regards,
Tom Ogilvy


"Slim" wrote:

Hello,

I'm attempting to write a macro that will insert a formula starting in
cell "C13", in every row (straight down the C column), to the end of the
range of the spreadsheet.

The formula I want to enter is
"=IF(AND(D13="",E13=""),"",IF(D13="","50","40" ))"

Is there anyone that could kindly help me with this?

Thanks.


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
HELP!!! I need macro to autofill Joe M. Excel Discussion (Misc queries) 4 February 10th 10 07:32 PM
Need Macro to autofill formula to last row with data Joe M. Excel Discussion (Misc queries) 4 January 22nd 10 07:54 PM
Autofill Macro Hayabusa Excel Programming 1 November 25th 05 05:47 PM
Macro, autofill formula to end of column Monica Excel Programming 3 January 22nd 04 03:34 PM
macro to autofill formula? Todd[_5_] Excel Programming 2 October 6th 03 07:10 PM


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