Results 1 to 2 of 2

Thread: VBA Code for excel formula
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Sep 2019
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default VBA Code for excel formula

    I have to include the below formula(IN BOLD) in a for loop of a vba code and compare with another cell with the same formula using IF ELSE Condition, but it keeps on throwing compile error.

    =(VALUE(MID(A2,2,FIND(" ",A2)-2)))*IF(VALUE(MID(A2,SEARCH("through",A2)+8,1))>=4,4,VALUE(MID(A2,SEARCH("through",A2)+8,1)))

    PFB the vba code i have written

    ElseIf ( (VALUE(MID(x(10,j),2,FIND(" ",x(10,j))-2)))*( If (VALUE(MID(x(10,j),SEARCH("through",x(10,j))+8,1))) >= 4 Then 4 Else (VALUE(MID(x(10,j),SEARCH("through",x(10,j))+8,1)))) >

    (VALUE(MID(Plan(x(4,j)& x(10,1)),2,FIND(" ",Plan(x(4,j)& x(10,1)))-2)))*( If(VALUE(MID(Plan(x(4,j)& x(10,1)),SEARCH("through",Plan(x(4,j)& x(10,1)))+8,1))) >= 4 Then 4 Else (VALUE(MID(Plan(x(4,j)& x(10,1)),SEARCH("through",Plan(x(4,j)& x(10,1)))+8,1)))))

    Then wsCompetitor.Cells(10, j).Interior.Color = RGB(0, 255, 255)

  2. #2
    Board Regular James006's Avatar
    Join Date
    Apr 2009
    Post Thanks / Like
    19 Post(s)
    1 Thread(s)

    Default Re: VBA Code for excel formula


    To get a VBA ' translation' of your formula ...

    Just turn on your macro recorder and input the formula ...

    Hope this will help

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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