Announcement

Collapse
No announcement yet.

Enter Formula With VBA

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Enter Formula With VBA

    I previously requested help and several folks helped me out. I've found that if I can convert to a VBA It would be easier. I can record the Macro but was wondering if anyone had any better ideas. Heres the formula I'm trying to work into a macro using VBA. Thanks

    = DATE(LEFT(J3,4)+CHOOSE(MATCH(B3,{"CAPT","CDR","LCDR"}),38,35,30),MID(J3,5,2),RIGHT(J3,2))

    THanks very much
    Billyj

  • #2
    Re: Use Formula In Vba

    You can't use that formula?

    Code:
    Range("C1").Formula = "=sum(A1:B1)"

    Comment


    • #3
      Re: Use Formula In Vba

      Thanks for the quick response. But I honestly do not know how to apply what you are saying. Thanks again

      Comment


      • #4
        Re: Use Formula In Vba

        Code:
        Range("A1").Formula = "=DATE(LEFT(J3,4)+CHOOSE(MATCH(B3,{"CAPT","CDR","LCDR"}),38,35,30),MID(J3,5,2),RIGHT(J3,2))"
        ...would place your exact formula into cell A1.

        Comment


        • #5
          Re: Use Formula In Vba

          Sorry brain burp.. I understand. Thanks

          Comment


          • #6
            Re: Use Formula In Vba

            You need to double up the interior quotes:
            Code:
            Range("A1").Formula = _
            "=DATE(LEFT(J3,4) + CHOOSE(MATCH(B3, {""CAPT"",""CDR"",""LCDR""}), 38,35,30), MID(J3,5,2), RIGHT(J3,2))"
            Entia non sunt multiplicanda sine necessitate.

            Comment


            • #7
              Re: Enter Formula With VBA

              I can record the Macro but was wondering if anyone had any better ideas
              That IS the best way, the Macro Recorder wont lie

              Comment


              • #8
                Re: Enter Formula With VBA

                Thanks everyone. I have used the recorder as well as your advice. I appreciate the help.

                Comment

                Working...
                X