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: 65
Default VBA Code and Summing Next Non-Blank Cell in Column

I am using the code below to place a sum subtotal of values in Column V
whenever there is blank cell in Column U. The macro provides the correct
result but as the sheet has over 20,000 entries the macro takes about 10
minutes to complete. Is there a more time efficient (or non-VBA) way to
provide the same result?

Thanks

Sub test()
'place a subtotal in column(V) wherever column(U) has a blank cell
lrow = Range("u65536").End(xlUp).Row + 1
For Each cell In Range("u2:U" & lrow)
If cell.Value = isblank Then
cell.Offset(0, 1).Formula = "=SUM(R[" & -RowCount & "]C[-1]:R[-1]C[-1])"
RowCount = 0
Else
RowCount = RowCount + 1
End If
Next
End Sub
 
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
Keep the first cell when summing a column? JungleJim74 Excel Discussion (Misc queries) 2 September 11th 09 06:34 PM
Summing a column based on the length of text in a cell in anothercolumn [email protected] Excel Worksheet Functions 13 November 26th 08 05:42 PM
Summing a column based on input in a cell Taza Excel Discussion (Misc queries) 2 April 3rd 08 03:58 AM
Summing (or counting) cells until there is a blank cell Box815 Excel Discussion (Misc queries) 3 November 17th 06 03:35 PM
Summing every other cell in a column? RJH Excel Worksheet Functions 4 April 13th 06 03:19 AM


All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"