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: 1
Default auto sum macro if data is present above the cell


total needs to be underneath ive come up with this but it isnt looping
to the next area of data this is it;


Sub A_This_one_works()
Dim rwIndex As Integer
Dim colIndex As Integer
Dim i As Integer

colIndex = 14
For rwIndex = 1 To 5
If Cells(rwIndex, colIndex).Value < 0 Then
i = i + 1
End If
Next rwIndex

If Range("L14").End(xlUp).Offset(1, 0).Select = "" Then
Selection.FormulaR1C1 = "=SUM(R[" & -i & "]C:R[-1]C)"
End If

Selection.FormulaR1C1 = "=SUM(R[" & -i & "]C:R[-1]C)"

End Sub

im not real sure how it works my self(not good programming practices)
but in paying around i got it to go. if i change the colindex and the
Range its goes to the last set of numbers and sums those. and lastly
the blank cell is allready under the last number in the set of data.
thanks for all your help i realy do appreciate it.


--
onesaint
------------------------------------------------------------------------
onesaint's Profile: http://www.excelforum.com/member.php...fo&userid=9379
View this thread: http://www.excelforum.com/showthread...hreadid=270957

 
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
Highlight a Cell if Data not Present AceWill Excel Discussion (Misc queries) 0 March 10th 10 04:18 PM
Auto Insert the present time when a cell is filled with a data, Dinanath New Users to Excel 2 March 8th 09 08:28 PM
auto sum macro if data is present above the cell onesaint[_5_] Excel Programming 1 October 22nd 04 12:10 AM
auto sum macro if data is present above the cell onesaint[_4_] Excel Programming 0 October 21st 04 06:29 PM
auto sum macro if data is present above the cell onesaint[_3_] Excel Programming 1 October 20th 04 08:35 PM


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