Automatic List Numbering in VBA Code Giving Error Plz Help

mazher

Active Member
Joined
Nov 26, 2003
Messages
355
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I am using the following code to enter the automatic list numbers

[B7:B10].Formula = "=IF(C7<>"",COUNTA($C$7:C7),"")"

but its giving me the error

Runtime Error 1004
Application Defined or Object Defined Error

Help will be appreciated


Regards



Mazher
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
It's probably the double quotes before closing the parenthesis.
Code:
Range("B7:b10").FormulaR1C1 = "=IF(RC[1]<>"""",COUNTA(R7C3:RC[1]),"""")"
 
Upvote 0
Dear mikerickson

Your code is working fine

Range("B7:b10").FormulaR1C1 = "=IF(RC[1]<>"""",COUNTA(R7C3:RC[1]),"""")"

Now this one is giving error

FinalRow = Range("F65536").End(xlUp).Row
TotalRow = FinalRow + 1
Range("b7:b" & TotalRow).FormulaR1C1 = "=IF(RC[1]<>"""",COUNTA(R7C3:RC[1]),"""")"

Runtime Error 404
Object Required

I have data in columns C to F the data starts from row 7

Cell B6 = "SNo."

I want to add the automatic list numbering formula from cells B7 to downward till the data in the columns C to F

I also dont want to show the formulas in cell B7 downward I want to paste Special Values insted of formula.


Please help



Regards



Mazher
 
Upvote 0

Forum statistics

Threads
1,213,559
Messages
6,114,302
Members
448,564
Latest member
ED38

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