View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
dread dread is offline
external usenet poster
 
Posts: 17
Default Help coding a macro to detete blank rows and provide totals

Hi Halim,

Instead of displaying the total in the MsgBox, how would I code this to
display the total in the first blank row?

Thanks.

"Halim" wrote:

Hi dread,

You can do this :

Sub Total()
Dim R As Range, TTL As Integer
For Each R In Range("B1:B50") ' change Range("B1:B50") to your range
If R.Value < "" And IsNumeric(R.Value) Then TTL = TTL + R.Value
Next R
MsgBox TTL
End Sub

--

Regards,

Halim


"dread" wrote:

I have a macro that copies information from several worksheets into one
worksheet. After the information is copied the macro sorts the new worksheet
so that blank rows are moved to the end. I want to code the macro to also
find the first blank row (after the copied data) and give me totals. How do
I do this?

Thank you.