Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Need help to have macro populate a column with formula to end ofcolumn.

My formula that should populate column K is: =SUM(J1/MACRO!G11), which
takes the value in the same row (column J) and divides into a
refereced cell, which will stay the same always. The macro should
evaluate until the end of the column.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Need help to have macro populate a column with formula to end ofcolumn.

how does the program decide where the end of the column is?
susan

On Jan 22, 2:17*pm, S Himmelrich wrote:
My formula that should populate column K is: =SUM(J1/MACRO!G11), which
takes the value in the same row (column J) and divides into a
refereced cell, which will stay the same always. *The macro should
evaluate until the end of the column.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Need help to have macro populate a column with formula to end ofcolumn.

On Jan 22, 1:17*pm, S Himmelrich wrote:
My formula that should populate column K is: =SUM(J1/MACRO!G11), which
takes the value in the same row (column J) and divides into a
refereced cell, which will stay the same always. *The macro should
evaluate until the end of the column.


Not sure I fully understood your message, but I think your looking for
a macro that will fill down the formula in Column K until it matches
the lenght of Column J? If so try this:

Sub filldown()
Dim rng As Range
' 'Fill Formula down formula in K until last J with data
Set rng = Range(Cells(1, "J"), Cells(Rows.Count, "J").End(xlUp))
rng.Offset(0, 1).Formula = "=SUM(J1/MACRO!$G$11)"
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Need help to have macro populate a column with formula to end ofcolumn.

Here is what I'm looking for, however I get an error on the row I've
designated as an error:

Dim last7 As Long
last7 = Worksheets("Working Sheet").Cells(Rows.Count,
"D").End(xlUp).Row
Range("K1").Formula = "=IF(RC[1]="","",SUM(RC[1]/MACRO!$G$11))"
Range("K1").AutoFill Destination:=Range("K1:K" & last7) <---ERROR
HERE
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Need help to have macro populate a column with formula to end ofcolumn.

On Jan 22, 1:35*pm, S Himmelrich wrote:
Here is what I'm looking for, however I get an error on the row I've
designated as an error:

* * Dim last7 As Long
* * last7 = Worksheets("Working Sheet").Cells(Rows.Count,
"D").End(xlUp).Row
* * Range("K1").Formula = "=IF(RC[1]="","",SUM(RC[1]/MACRO!$G$11))"
* * Range("K1").AutoFill Destination:=Range("K1:K" & last7) *<---ERROR
HERE


Try mine but Substitue J for D, try this:

Sub filldown()
Dim rng As Range
' 'Fill Formula in K dowun until last D with data
Set rng = Range(Cells(1, "D"), Cells(Rows.Count, "D").End(xlUp))
rng.Offset(0, 7).Formula = "=IF(J1="""","""",SUM(J1/MACRO!$G
$11))"
End Sub


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help to have macro populate a column with formula to end ofcolumn.

Check your first thread.

S Himmelrich wrote:

My formula that should populate column K is: =SUM(J1/MACRO!G11), which
takes the value in the same row (column J) and divides into a
refereced cell, which will stay the same always. The macro should
evaluate until the end of the column.


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Need help to have macro populate a column with formula to end ofcolumn.

Solution:

Dim rng As Range
Set rng = Range(Cells(1, "D"), Cells(Rows.Count, "D").End(xlUp))
rng.Offset(0, 7).Formula = "=IF(J1="""","""",SUM(J1/MACRO!$G$11))"
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help to have macro populate a column with formula to end ofcolumn.

You have a response to this similar post at the original thread.

S Himmelrich wrote:

Solution:

Dim rng As Range
Set rng = Range(Cells(1, "D"), Cells(Rows.Count, "D").End(xlUp))
rng.Offset(0, 7).Formula = "=IF(J1="""","""",SUM(J1/MACRO!$G$11))"


--

Dave Peterson
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
Populate a column of data with a formula using a drop down list nafflerbach Excel Discussion (Misc queries) 1 May 24th 07 12:20 PM
How to populate column with formula based on value in cell Cameron Stewart Excel Worksheet Functions 2 November 2nd 04 01:36 AM
How to populate column with formula based on value in cell Cameron Stewart Excel Programming 2 November 2nd 04 01:36 AM
Using a macro to populate a cell with a formula Steve Excel Programming 9 September 27th 04 10:26 PM
Write a macro to populate a column with a formula martinjw[_2_] Excel Programming 2 May 26th 04 05:48 PM


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