Counting non blank cells in column

Timbo50

New Member
Joined
May 15, 2015
Messages
18
Office Version
  1. 2019
Platform
  1. Windows
Can someone help please. I'm trying to assign a variable to count a column of data starting from, in my case cell G197, to the last non blank cell in the column. The data is added to daily so will always change.

I've been trying: nr = ActiveSheet.Range("g197", ActiveSheet.Cells(Rows.Count, 1).End(xlUp)).Rows.Count

but this only counts 2.
Any ideas please as to where I'm going wrong.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Welcome to the board.

Since it's column G you're wanting to test, you might want to change this part
ActiveSheet.Cells(Rows.Count, 1)
to
ActiveSheet.Cells(Rows.Count, 7)

or even
ActiveSheet.Cells(Rows.Count, "G")
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,824
Members
449,470
Latest member
Subhash Chand

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