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: 93
Default Formula Change

I'm looking for a change to this formula. Currently it will add the formula
to the range of cells, but it only calculates the first row of data in ALL
the cells. Instead of auto filling the formula and changing for the
appropriate row.

Sub WORKING()

Dim wks As Worksheet
Dim LastCol As Long
Dim FirstRow As Long
Dim FirstCol As Long

Set wks = Worksheets("MASTER")
With wks
FirstRow = 2
FirstCol = 4
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

' this section needs to be changed in some way

Range(Cells(2, LastColumn + 1), Cells(LastRow, LastColumn + 1)) =
Application.Sum _
(Cells(2, LastCol) - Cells(2, FirstCol - 2))

End Sub

I'm not sure how to get it to fill that formula and change the row for the
appropriate row. Make sense?

Example:

A B C D E F G H I
# 50 .71 40 48 88 38

Column I is the result from subtracting B(firstCol - 2) from column H (the
lastCol). That works correct. Now if I have that formula fill in all of row
all the cells in that column will be 38.

ANY help is appreciated, let me know if you need more info. Thanks!!!
 
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
change formula in a shared worksheet without losing change history DCE Excel Worksheet Functions 5 July 25th 08 01:37 PM
how to change formula in shared sheet without loss of change histo DCE Excel Worksheet Functions 1 July 23rd 08 05:09 PM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
How does Data Validation change with a formula change? MayClarkOriginals Excel Worksheet Functions 3 July 5th 06 04:50 AM


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