+ Reply to Thread
Results 1 to 2 of 2

Understanding this code

  1. #1
    Registered User
    Join Date
    02-13-2018
    Location
    Chicago
    MS-Off Ver
    2003
    Posts
    1

    Understanding this code

    I had a friend write this code for me a long time ago and it works really well. I'm trying to get into VBA myself and was wondering if anyone could explain the logic behind the code. I'm having a hard time understand why it was written this way and what each line accomplishes. The point of this module is to convert the decimal part of a cell from 1/8 to 1/10. As an example the number 300.4 would be converted to 300.5 after running the macro.

    Sub DecimalConverter()
    ' Convert8to10 Macro
    ' Macro recorded 12/8/2008
    ' Convert decimal from 8ths to 10ths

    Lastrow = Range("Au5536").End(xlUp).Row
    For Each Cell In Range("Au1", Cells(Lastrow, 47))
    If IsNumeric(Cell.Value) And _
    Cell.HasFormula = False And _
    Cell.Value <> "" Then
    Cell.Value = Int(Cell.Value) _
    + (Cell.Value - Int(Cell.Value)) * 10 / 8
    End If
    Next Cell
    End Sub


    Any input on the code would be greatly appreciated.

    Vjay

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,542

    Re: Understanding this code

    First read and act upon the forum rules, at the top. You'd be very interested in #3.

+ 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. [SOLVED] Understanding code
    By K243 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2018, 04:19 AM
  2. Understanding why the code works
    By coys1717 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2014, 05:42 AM
  3. Help with understanding VBA code
    By snaik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-05-2014, 04:22 PM
  4. need help understanding a bit of code
    By lazerphazer21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2013, 10:11 PM
  5. Understanding this VBA code
    By rez9000 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-28-2010, 10:14 AM
  6. Understanding Code for References
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-12-2010, 12:43 PM
  7. understanding code
    By karinos57 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2009, 08:35 PM

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