ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Loop (https://www.excelbanter.com/excel-discussion-misc-queries/270531-loop.html)

kevcar40

Loop
 
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

Don Guillett[_2_]

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

On Jun 21, 6:54*am, kevcar40 wrote:
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




All times are GMT +1. The time now is 05:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com