Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Sum Code/Function

I just wrote this up.

You have to start on the first value in the column you
want to count.

This only counts rows. You can edit it to count columns
if you want,

If you need this to be a Function just change Public Sub
to Function

Brad

Public Sub CountCells()
Dim ColumnVal As Integer, RowVal As Integer, RowValStart
As Integer
Dim SheetLocation As String
Dim CellLocation As String


ColumnVal = ActiveCell.Column
RowVal = ActiveCell.Row
RowValStart = ActiveCell.Row

Do Until Cells(RowVal, ColumnVal) = ""
RowVal = RowVal + 1
Loop

SheetLocation = InputBox("Please enter the Worksheet you
want the count to be placed into. i.e. the name on the
worksheet tab.")
CellLocation = InputBox("Please enter the cell you want
the count to be placed into. i.e W5 or AX2")

Sheets(SheetLocation).Range(CellLocation) = RowVal -
RowValStart

End Sub
-----Original Message-----
Is there a function/code that adds up the ammount of

rows in a worksheet and puts it in another worsheets
cell? Lets say I have a worksheet called 'MRIs in May'
and I want the function/code to add up the rows in that
worsheet starting from cell/row A2 and put that number in
a cell located in another worksheet called 'Totals'.
.

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
function or code? hal Excel Worksheet Functions 3 September 25th 08 08:14 PM
'Code breaking' function s4 Excel Discussion (Misc queries) 2 March 15th 08 01:00 PM
FUNCTION OR CODE ? tomjoe Excel Worksheet Functions 5 February 18th 08 05:39 PM
Function or Code Allan Excel Worksheet Functions 2 March 16th 05 06:55 PM
Left Function in code Les Stout Excel Programming 4 February 9th 04 07:07 PM


All times are GMT +1. The time now is 10:08 AM.

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"