I have a column of data in Excel that looks something like the list below, each value in a separate cell.

018126
018127
204288
204296
204319

I’ve been using

set x to formula of range ("A1:A50") of active sheet

to get the values out of the required range.
It works fine for nearly all the numbers however if there’s a leading zero that get missed and I need to retain that.

Is there a way round this? I’ve tried a number of different variations on a theme but as yet haven’t solved it.

I am. Here’s how i pulled zips from Column(R), Row(i):
set StudentZip to string value of cell (“Edit!R” & i)

If you’re still having trouble, here’s a routine I use:

on form(N, x, type)
set N to N as text
set y to length of N
if type is true then
set pad to character id (8199)
else
set pad to "0"
end if
if x is greater than y then
repeat with i from 1 to x - y
set N to pad & N
end repeat
end if
return N
end form

It looks like you’re looping through each cell one at a time however I’d being trying to get the cell values from a range. I think that’s why my code was throwing an error.