Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts

    VBA Code to compute Percentages

    I have a worksheet where the data is cleared and new data is imported each month.

    I need VBA code that will calculate the percentages in column C

    Your assistance inn this regard will be most appreciated
    Attached Files Attached Files

  2. #2
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Praha
    Posts
    988
    Thanks
    56
    Thanked 105 Times in 90 Posts
    There are lots of ways to do this, but why not start by recording a macro whilst you recreate these calculations on a freshly populated worksheet ?

    The macro will remain available when you clear the data/worksheet - and you will get some insights into how the VBA is structured if you take a look at it.

  3. #3
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi Martin

    That is fine, but the problem with this sheet that the rows containing the percentages continually change as new data is imported

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,433
    Thanks
    371
    Thanked 1,456 Times in 1,325 Posts
    Howard,

    Here's a possible solution. You must place the cursor on the 1st data element! Then press Alt+F8 and select the macro. It will do the work. I'd like to do a little more work on this for formatting and such but this is the basics. Hope it helps.
    Attached Files Attached Files
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Bronze Lounger
    Join Date
    Feb 2008
    Posts
    1,420
    Thanks
    124
    Thanked 5 Times in 5 Posts
    Hi RG

    Thanks for the help, much appreciated

Posting Permissions

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