+ Reply to Thread
Results 1 to 8 of 8

what is wrong with this code ?

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2015
    Location
    brazil
    MS-Off Ver
    2013
    Posts
    4

    Exclamation what is wrong with this code ?

    what is wrong with the code ?

    Formula: copy to clipboard
     ActiveCell.Offset(0, -1).Value = ActiveCell.Offset(0, -2) * ActiveCell(F2) / ActiveCell(F3) - ActiveCell.Offset(0, -3)


    help please!!!
    Last edited by segattoy; 01-27-2015 at 07:46 PM.

  2. #2
    Forum Contributor
    Join Date
    01-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    240

    Re: what is wrong with this code ?

    Will only work if active cell is column D or beyond...

    
    ActiveCell.Offset(0, -1).Value = ActiveCell.Offset(0, -2).Value * ActiveSheet.Range("F2").Value / ActiveSheet.Range("F3").Value - ActiveCell.Offset(0, -3).Value
    Please consider adding a * if I helped.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: what is wrong with this code ?

    Where is the code?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    01-23-2015
    Location
    brazil
    MS-Off Ver
    2013
    Posts
    4

    Re: what is wrong with this code ?

    thanks the logical part work, but the result is wrong.
    i will review the code but thanks anyway
    Last edited by segattoy; 01-27-2015 at 08:14 PM.

  5. #5
    Forum Contributor
    Join Date
    01-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    240

    Re: what is wrong with this code ?

    I suspect you need some brackets in there somewhere.

  6. #6
    Registered User
    Join Date
    01-23-2015
    Location
    brazil
    MS-Off Ver
    2013
    Posts
    4

    Re: what is wrong with this code ?

    Thank you so much, worked , i just need add the brackets kkk

    Formula: copy to clipboard
    ActiveCell.Offset(0, -1).Value = (ActiveCell.Offset(0, -2).Value * ActiveSheet.Range("F2").Value) / (ActiveSheet.Range("F3").Value - ActiveCell.Offset(0, -3).Value)
    Last edited by segattoy; 01-27-2015 at 08:29 PM.

  7. #7
    Registered User
    Join Date
    01-23-2015
    Location
    brazil
    MS-Off Ver
    2013
    Posts
    4

    Re: what is wrong with this code ?

    one more question kk i add one line to white the result in a textbox
    Formula: copy to clipboard
    TXTresultado.Text = ActiveCell.Offset(0, -1).Value

    but i just want show 2 decimal place what i need do ?

  8. #8
    Forum Contributor
    Join Date
    01-14-2014
    Location
    London, England
    MS-Off Ver
    Excel 2013
    Posts
    240

    Re: what is wrong with this code ?

    
    TXTresultado.Text = format(ActiveCell.Offset(0, -1).Value  , "#.##")
    Last edited by Brendan_Floyde; 01-28-2015 at 06:21 AM. Reason: add code tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. what is wrong with this code- error from vba code
    By punna111 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2013, 03:14 PM
  2. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  3. Wrong line of code banned me out and can't access vba code...
    By albertc in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-14-2012, 02:41 PM
  4. Take a look at my code and tell me what is wrong with this
    By yl358 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2006, 07:15 PM
  5. What is wrong with my code???
    By sand in forum Excel General
    Replies: 1
    Last Post: 06-27-2005, 01:05 PM

Tags for this Thread

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