+ Reply to Thread
Results 1 to 5 of 5

VBA Macro Column Rounding & Cleanup

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    VBA Macro Column Rounding & Cleanup

    Hello,

    I created a macro that cleaned up a spread sheet into two columns. My first column (A) contains a list of names and my second column (B) contains weights. Although column B is percentages, I cannon have the cell formatted as a percentage, so I converted the column to "General". I need help with two issues. Also, I am taking 98% of Column B.

    1) I need column (B) to stop with the last name displayed in t column A. Each A cell corresponds to B, so I don't want to have B running all the way down to B200. Column A range can fluctuate, so I need B to react to A dynamically.

    2) I need column B to round to two decimal places. Rounding up will be fine. I need to have it in the same "General" format.

    I have attached the spread sheet and will post my code below.

    Please Login or Register  to view this content.

    Any help would be much appreciated
    Attached Files Attached Files
    Last edited by btone; 08-26-2015 at 12:04 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Macro Column Rounding & Cleanup

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Macro Column Rounding & Cleanup

    Hey stnkynts,

    Thanks for the help. However, I need to all of Column B to be multiplied by 98% and display it as a percent, but keeping the format in "General" form.

    For example, Cell B should display "1.12" because 1.14712743212651*0.98=1.12418488348

    Below is Code and I have attached an updated excel sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Macro Column Rounding & Cleanup

    Do you mean like this?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-22-2014
    Location
    San Diego, CA
    MS-Off Ver
    Excel 2011
    Posts
    44

    Re: VBA Macro Column Rounding & Cleanup

    Hey stnkynts,

    Thanks for the reply.

    After inserting that code, I am getting a "Compile Error: Expected End Sub" Message and it is highlighting "xlUp" on the 4th line of code that reads "Selection.Delete Shift:=xlUP"

    Please Login or Register  to view this content.

+ 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. Data cleanup: separating values in a column
    By ikaros in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-11-2015, 11:16 AM
  2. VBA Cleanup
    By specialk9203 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2014, 09:50 AM
  3. Macro to cleanup data based on lookup fields
    By fish221171 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2014, 11:11 AM
  4. Matching a value to a column, (rounding) and returning offset column value
    By jayinthe813 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2013, 02:42 PM
  5. Macro to cleanup data
    By Castlewood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2008, 06:31 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