• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help with conversion macro

Newwbiexcel

New Member
Need help to create a macro i have a range of a2:a102 which are metric need to convert imp in b2:b102 without a formula in the cell. I also need it to do imp to mm. Can anyone helo and explain? Or even point me in the right direction!

Thanks
 
Hi Asheesh, thanks for the welcome! Basically i dont have an excel file i just want to do a conversion excel that will do distances from metric to imperial in a marco
 
Unfortunately some people woth whom i work really dont know how to use excel so far this tis what i have now i need this to run automatically how can i do this?

Sub convert()
Dim i as long
For i=3 to 103
If range ("a"&i) > 0.01 then
Range ("c"&i) = range ("a"&i)×25.4
End if
If range ("b"&i) > 0.01 then
Range ("d"&i) = range ("b"&i)×25.4
End if
Next
Sub
 
Even in VBA I directly use CONVERT Excel function
so no need to slow down code with a loop and If …

Example to convert centimeters in A2:A9 to inches in B2:B9 :​
Code:
Sub Demo1()
    With [B2:B9]
        .Formula = "=CONVERT(A2,""cm"",""in"")"
        .Formula = .Value
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Back
Top