Videos
Surly all you want to do is format the cells and copy the values?
Like below?
With Range("C2:C6")
.Value = Range("A2:A6").Value
.NumberFormat = "000000"
End With
The macro recorder gave me similar to above with some optimisations
Using formula
Range("C2").FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Range("C3").FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Range("C4").FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Range("C5").FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Range("C6").FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Or something a little bit more dynamic
For Each cell In Range("C2:C6")
cell.FormulaR1C1 = "=TEXT(RC[-2],""000000"")"
Next
One line code
Sub Sample()
[C2:C6] = [INDEX("'" & TEXT(A2:A6,"000000"),)]
End Sub
If you want explanation on this then see This
I have frequently experienced that VBA (2010) will highlight a missing library for an item for which the library is not missing because another library in fact is missing. It's usually just the first reference to any library in the code. So you should look for a missing library further down in the code, more likely, a not so standard object.
I have also frequently experienced (with any version of VBA up to 365) that errors aren't shown right away but are "remembered". I have explained this to myself by acknowledging that given a large project VBA will assemble the parts it needs as it needs them but once an error was discovered it won't be overlooked a second time and is flagged right away. This behavior could explain why only one of your PCs objects to the code. The others just didn't get around to it yet.
I would guess there must be an add-on or a language setting that is causing a conflict. However as Tim Williams pointed out, you're using the worksheet function in VBA when a VBA function exists that does this exact task you need to complete it.
While probably not necessary, you could go even further and scope the formulas to be vba specific just to ensure the proper library is being utilized.
MsgBox VBA.UCase(VBA.Mid("SomeText!", 4, 3))