VBA for each row COUNTA specific columns, put results in column HY

LNG2013

Active Member
Joined
May 23, 2011
Messages
428
Hi Friendly Folks,

I need help with a VBA script that looks at each row on Sheet1, and does a CountA for Columns AI, AO, AU, BA, BG, CG, CM, CS, CY, DE, EE, EK, EQ, EW, FC, GC, GI, GO, GU, HA. It should put the put put in each row, in column HY.

Or Numerical equivalent
35, 41, 47, 53, 59, 85, 91, 97, 103, 109, 135, 141, 147, 153, 159, 185, 191, 197, 203, 209


Thank you warmly in advance!
 

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

pbornemeier

Well-known Member
Joined
May 24, 2005
Messages
3,884
This should work:

It assumes data starts in row 2 and the last populated cell in column A is in the last populated row of the worksheet.
Rich (BB code):
Sub BigCOUNTA()

    Dim lLastDataRow As Long
    
    lLastDataRow = Cells(Rows.Count, 1).End(xlUp).Row
    With Range("HY2:HY" & lLastDataRow)
        .FormulaR1C1 = _
            "=COUNTA(RC35, RC41, RC47, RC53, RC59, RC85, RC91, RC97, RC103, RC109, RC135, RC141, RC147, RC153, RC159, RC185, RC191, RC197, RC203, RC209)"
        Application.Calculate
        .Value = .Value
    End With
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,514
Messages
5,602,087
Members
414,501
Latest member
mdhaumyu

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
Top