LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Filling Formula down???

I am trying to code a macro to fill a unique formula down until it
reaches the end of file, which will have changed every time I run the
macro. I can manually type in the formula and fill down- everything
works fine then. I haven't been able to get the macro to work yet,
though.

A B C
1 H H H <-- H denotes column heading
2 N 5 F F denotes formula I want to fill down
3 N 6 F N denotes name
4 N 7 F

Here's my function so far:


Function formula1()
Range("C2").Select
ActiveCell.Formula = "=$B2/SUMIF($A:$A,$A2,$B:$B)"'thanks to KDales for
formula

dim lastrow
Set EndCell = ActiveSheet.UsedRange
lastrow = EndCell(EndCell.Count).Row

Selection.AutoFill Destination:=Range("C2", "C" & cstr(lastrow)),
Type:=xlFillDefault
End Function


I always get an error when my macro calls this function: "Autofill
method of Range class failed." I know that there are many other posts
about filling down, but none of them seemed to help. My columns A, B,
and C will not be moving though the last row will vary every time, and
there will be no gaps in data in columns A or B. I'm using Excel XP on
Windows XP. I'm still a beginner at all this so thanks for your time.
Brett

 
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
formula (a1*a2) filling down becomes (a2*a3) i want (a1*a3) Help! Coolchick Excel Worksheet Functions 3 May 1st 08 12:16 PM
Formula filling Smalawi Excel Worksheet Functions 5 March 1st 08 03:12 AM
Formula filling???? Smalawi Excel Worksheet Functions 2 February 29th 08 11:13 PM
help with filling in an array formula Caitlin Excel Discussion (Misc queries) 5 November 7th 06 08:12 PM
Filling Down Formula Glenn Excel Discussion (Misc queries) 3 April 15th 05 12:40 AM


All times are GMT +1. The time now is 05:40 PM.

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"