I have a column of payroll code data consisting of 12 character in column B, as follows:
"010203RP0001"
which needs to be expanded into an account code, in column C, of the following format:
"01.02.03.00.00.00.11900.0001"
My formula to create this is as follows:
When I insert this in VBA code, I get problems with adding the decimal places between every consecutive 2 digits, unless I enclose them in single digits like follows:
But I also get a Object defined error. Does this possibly relate to the reference to the salary code table (sal_code) defined in the worksheet? If so, how do I get around this?
"010203RP0001"
which needs to be expanded into an account code, in column C, of the following format:
"01.02.03.00.00.00.11900.0001"
My formula to create this is as follows:
Code:
=LEFT(B15,2) & "." & MID(B15,3,2) & "." & MID(B15,5,2) & ".00.00.00." & VLOOKUP(MID(B15,7,2),sal_code,2,FALSE) & "." & RIGHT(B15,4)
When I insert this in VBA code, I get problems with adding the decimal places between every consecutive 2 digits, unless I enclose them in single digits like follows:
Code:
ActiveCell.Formula = "=LEFT(B13,2) & '.' & MID(B13,3,2) & '.' & MID(B13,5,2) & '.00.00.00.' & VLOOKUP(MID(B13,7,2),sal_code,2,FALSE) & '.' & RIGHT(B13,4)"
But I also get a Object defined error. Does this possibly relate to the reference to the salary code table (sal_code) defined in the worksheet? If so, how do I get around this?