Loop

  • Thread starter Thread starter kevcar40
  • Start date Start date
K

kevcar40

Hi
I have a column of numbers
column N Holds the Numbers
some of the numbers are 1 digit, some 2 digits
some 6 digits and some 7 digits
What i would like to do is :-
loop through the column
if it is a 1 or 2 digit number
copy and paste the value to column N, O and P
i.e m2 = 1 copy 1 to O2 and P2

if it is a 6 digit number
ie M2=123456 n2 = "=DEC2HEX(RC[-1],5) o2 = "=LEFT(RC[-1],2)" P2 = "=HEX2DEC(RC[-1])


if it is a 76 digit number
ie M2=1234567 n2 = "=DEC2HEX(RC[-1],6) o2 = "=LEFT(RC[-1],2)" P2 = "=HEX2DEC(RC[-1])


What is the best way for me to go about this

thanks

kevin
 
You could use formulas or I would set up a looping macro with
selectcase for the value. How many rows?
 
Back
Top