OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Hello and thanks in advance for any assistance you can provide. Via Google search I have searched this forum and others, but my sheet is not protected and this code has previously worked I just can't find where I have used it previously.
Why am I getting the error "Run-time error '1004' Unable to set the Number Format property of the Range class" for the following line:
in the following code and how do I fix it?
But why do I not get the same error in the following code:
when I use the following line of code instead
Once again thanks for your assistance.
Why am I getting the error "Run-time error '1004' Unable to set the Number Format property of the Range class" for the following line:
VBA Code:
Range("C" & i).NumberFormat = "[>=1000000] #,##0.0,,""m"";[>0] #,##0.0,""k"
in the following code and how do I fix it?
VBA Code:
Public Sub TestNF()
Dim i As Long
i = 71
Range("C" & i).Value = 12345684
Range("C" & i).NumberFormat = "[>=1000000] #,##0.0,,""m"";[>0] #,##0.0,""k"
End Sub
But why do I not get the same error in the following code:
VBA Code:
Public Sub TestNF()
Dim i As Long
i = 71
Range("C" & i).Value = 12345684
Range("C" & i).NumberFormat = "#,##0.00"
End Sub
when I use the following line of code instead
VBA Code:
Range("C" & i).NumberFormat = "#,##0.00"
Once again thanks for your assistance.