Lizzielady
New Member
- Joined
- May 6, 2011
- Messages
- 5
Hi guys!
Having a problem with one of my bits of code, hope someone can help
?!
I have a list of employee numbers which are either 3 or 4 digits long, the list can be anything from 1 row and up. It depend on what absences have been taken in that department.
I have wrote a macro which basically runs an import sheet, but the system in imports too needs the numbers to be in six digit style, so either 00 or 000 in front of number.
I wrote the below and it works, unless there is only one employee to import, then I get a 'Type Mis-match' error....am I missing something?
Dim a
Dim i As Long
With Range("A2", Range("A" & rows.Count).End(xlUp))
.NumberFormat = "@"
a = .Value
For i = 1 To UBound(a, 1)
a(i, 1) = Right("00000" & a(i, 1), 6)
Next i
.Value = a
End With
Thanks
Having a problem with one of my bits of code, hope someone can help
I have a list of employee numbers which are either 3 or 4 digits long, the list can be anything from 1 row and up. It depend on what absences have been taken in that department.
I have wrote a macro which basically runs an import sheet, but the system in imports too needs the numbers to be in six digit style, so either 00 or 000 in front of number.
I wrote the below and it works, unless there is only one employee to import, then I get a 'Type Mis-match' error....am I missing something?
Dim a
Dim i As Long
With Range("A2", Range("A" & rows.Count).End(xlUp))
.NumberFormat = "@"
a = .Value
For i = 1 To UBound(a, 1)
a(i, 1) = Right("00000" & a(i, 1), 6)
Next i
.Value = a
End With
Thanks