VBA Count above values below.

Stephen_IV

Well-known Member
Joined
Mar 17, 2003
Messages
1,168
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Good morning,

I need help with some VBA. I have about 350,000 rows of data. What I am trying to do is to put the actual count above the numbers they are counting. Please see below. Thanks in advance!



<style type="text/css">
table.tableizer-table {
font-size: 12px;
border: 1px solid #CCC ;
font-family: Arial, Helvetica, sans-serif;
}
.tableizer-table td {
padding: 4px;
margin: 3px;
border: 1px solid #CCC ;
}
.tableizer-table th {
background-color: #104E8B ;
color: #FFF ;
font-weight: bold;
}
</style>
<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>Account Numbers</th><th>Count</th></tr></thead><tbody>
<tr><td> </td><td>7</td></tr>
<tr><td>400005</td><td> </td></tr>
<tr><td>4000013</td><td> </td></tr>
<tr><td>198051</td><td> </td></tr>
<tr><td>401136</td><td> </td></tr>
<tr><td>1797049</td><td> </td></tr>
<tr><td>2396013</td><td> </td></tr>
<tr><td>1097060</td><td> </td></tr>
<tr><td> </td><td>4</td></tr>
<tr><td>599146</td><td> </td></tr>
<tr><td>7654321</td><td> </td></tr>
<tr><td>9394083</td><td> </td></tr>
<tr><td>2697015</td><td> </td></tr>
<tr><td> </td><td>2</td></tr>
<tr><td>4000005</td><td> </td></tr>
<tr><td>4000056</td><td></td></tr>
</tbody></table>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
How about
Code:
Sub Stephen_IV()
   Dim Rng As Range
   
   For Each Rng In Range("A2:A" & Rows.Count).SpecialCells(xlConstants).Areas
      Rng.Offset(-1, 1).Resize(1).Value = Rng.Count
   Next Rng
End Sub
 
Upvote 0
That was fast!! Amazing Fluff!!!! I appreciate your help and guidance on this!!!!
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,375
Members
449,098
Latest member
Jabe

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