Consulting

Results 1 to 5 of 5

Thread: Solved: convert formula to VBA

  1. #1

    Solved: convert formula to VBA

    Hi,
    pls. how can i convert this formula to vba code?

    =VALUE(LEFT(E10;FIND("/";E10)-1)&MID(E10;FIND("/";E10)+1;20))
    thx for help

  2. #2
    i tried this, but it doesnt works

    [vba]
    b = (Left(bunka, InStr(1, "/", bunka) - 1) & Mid(bunka, InStr("/", bunka) + 1, 20))
    [/vba]

    bunka - is variable to my active cell

  3. #3
    i got it
    maybe somebody use this info

    [VBA]
    b = (Left(bunka, InStr(1, bunka, "/") - 1) & Mid(bunka, InStr(1, bunka, "/") + 1, 20))
    [/VBA]

  4. #4
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    I know that you worked out your answer, but out of curiosity, did you think about asking the macro recorder?

    [vba]ActiveCell.FormulaR1C1 = _
    "=VALUE(LEFT(R[8]C[2],FIND(""/"",R[8]C[2])-1)&MID(R[8]C[2],FIND(""/"",R[8]C[2])+1,20))"[/vba]

    Granted it's not as clean, but it will give you exactly what you're after. This is written in R1C1 notation, but you could just as easily convert it to A1 notation.

    Hope it helps for future,
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  5. #5
    Quote Originally Posted by Ken Puls
    I know that you worked out your answer, but out of curiosity, did you think about asking the macro recorder?

    [vba]ActiveCell.FormulaR1C1 = _
    "=VALUE(LEFT(R[8]C[2],FIND(""/"",R[8]C[2])-1)&MID(R[8]C[2],FIND(""/"",R[8]C[2])+1,20))"[/vba]

    Granted it's not as clean, but it will give you exactly what you're after. This is written in R1C1 notation, but you could just as easily convert it to A1 notation.

    Hope it helps for future,
    you right, i will really help for the future. thx a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •