+ Reply to Thread
Results 1 to 4 of 4

Formula to VB Code

Hybrid View

  1. #1
    Registered User
    Join Date
    02-24-2005
    Location
    US,Tennessee
    Posts
    28

    Formula to VB Code

    I have a cell formula =IF(J61>500,500,J61*-1) that I want to put into a macro. How would this formula need to be typed in a line of code.

  2. #2
    Bob Phillips
    Guest

    Re: Formula to VB Code

    ACtivecell.Formula = "=IF(J61>500,500,J61*-1)"

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "icetrey" <icetrey.2bjhbc_1153894804.1878@excelforum-nospam.com> wrote in
    message news:icetrey.2bjhbc_1153894804.1878@excelforum-nospam.com...
    >
    > I have a cell formula -=IF(J61>500,500,J61*-1)- that I want to put
    > into a macro. How would this formula need to be typed in a line of
    > code.
    >
    >
    > --
    > icetrey
    > ------------------------------------------------------------------------
    > icetrey's Profile:

    http://www.excelforum.com/member.php...o&userid=20329
    > View this thread: http://www.excelforum.com/showthread...hreadid=565031
    >




  3. #3
    Registered User
    Join Date
    02-24-2005
    Location
    US,Tennessee
    Posts
    28
    Thanks. That worked great.

  4. #4
    NickHK
    Guest

    Re: Formula to VB Code

    Or do you mean:
    With ActiveCell
    If Range("J61").Value>500 Then
    .Value=500
    Else
    .Value =Range("J61").Value-1
    End If
    End With

    NickHK

    "icetrey" <icetrey.2bjhbc_1153894804.1878@excelforum-nospam.com> wrote in
    message news:icetrey.2bjhbc_1153894804.1878@excelforum-nospam.com...
    >
    > I have a cell formula -=IF(J61>500,500,J61*-1)- that I want to put
    > into a macro. How would this formula need to be typed in a line of
    > code.
    >
    >
    > --
    > icetrey
    > ------------------------------------------------------------------------
    > icetrey's Profile:

    http://www.excelforum.com/member.php...o&userid=20329
    > View this thread: http://www.excelforum.com/showthread...hreadid=565031
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1