Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
function or code? | Excel Worksheet Functions | |||
'Code breaking' function | Excel Discussion (Misc queries) | |||
FUNCTION OR CODE ? | Excel Worksheet Functions | |||
Function or Code | Excel Worksheet Functions | |||
Left Function in code | Excel Programming |