How can I count all the active cell in Column A then put the total on the bottom

suicidalporcupine

Board Regular
Joined
Apr 1, 2015
Messages
90
So I have a very simple problem, but when I search on how to do it, it seems the code I have been seeing are longer than it's suppose to be?

So here's my problem

Everyday Column A generates a different set of numbers.
What I need is to count all the cell and input the total on the last cell:

and possibly underline the last number?
232
2321
2434
1343
4

really appreciate any input
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Maybe

Code:
Sub k1()
LastRow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
Cells(LastRow + 1, 1) = LastRow
Cells(LastRow, 1).Font.Underline = xlUnderlineStyleSingle
End Sub
 
Last edited:
Upvote 0
Try this

Sub countAbove1A()
Dim ran As Range, rAbove As Range
Dim ShtF As WorksheetFunction
Set ShtF = Application.WorksheetFunction
Range("a65536").Select
Selection.End(xlUp).Offset(1).Select

Set ran = ActiveCell
Set rAbove = Range(ran.Offset(-1, 0), Cells(1, ran.Column))
ran.Formula = "=count(" & rAbove.Address & ")"
ran.Offset(-1).Font.Underline = True
End Sub
 
Upvote 0
thanks, sorry I'm really new to this,. don't think it works.. it's giving me the error expected end sub.
 
Last edited:
Upvote 0
I can't use those because there are 2 sets of numbers for each column,.

but I only want excel to count the first list:

5435
5476
7897
2354
887
5454
6



56
65
634
24


So is there a code for vba to select the cell after 5454 so i can insert the =COUNTA(B2:B20)

or is there an easier way than what I'm planning?
 
Upvote 0

Forum statistics

Threads
1,215,389
Messages
6,124,662
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top