+ Reply to Thread
Results 1 to 5 of 5

Reduce code recorded from a macro in excel vba using a loop

  1. #1
    Registered User
    Join Date
    07-23-2014
    Location
    london, england
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Reduce code recorded from a macro in excel vba using a loop

    Hi All,

    I a newbie VBA coder but finding it really difficult to reduce my code from a recorded macro using a loop - i'm pretty sure i need a loop as i was copying and pasting data from one data table into a newly created summary table. Could anyone help me please? Any help would be much appreciated!

    The code is too long to add into the post so i've attached a notepad file ...
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Reduce code recorded from a macro in excel vba using a loop

    Hi
    can you tell us what you want the macro to do? That would be a lot easier than scrolling through the code

  3. #3
    Registered User
    Join Date
    07-23-2014
    Location
    london, england
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Re: Reduce code recorded from a macro in excel vba using a loop

    Hi,

    I want to be able to create a new table (with no formal table headers), with 8 customer names going down the first column and then the top row will be cell titles that i have copied from another table in the same worksheet. Then for each of the customers in the table i would copy/paste the data from their respective tables in the worksheet into the correct column header but in the form of an icon and not a data value.

    TableExample.png


    The data in column 1/2 has been copied and pasted from another table in the same worksheet.

    I hope that makes better sense now

    Thanks for your help

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Reduce code recorded from a macro in excel vba using a loop

    ok, without seeing your spreadsheet it's a bit hard to work out, but this should give you some ideas

    it copies your headers from one range, matches names in a second range with a larger source table containing these and other names,
    then copies these values into the columns next yto your names list. Then, it searches and replaces values in that area of the worksheet.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-23-2014
    Location
    london, england
    MS-Off Ver
    MS Office 2010
    Posts
    3

    Re: Reduce code recorded from a macro in excel vba using a loop

    I've attached my spreadsheet - hopefully this will show what i'm trying to do ... I've not completed the copy/paste action in the macro as the code was getting too long

    Thank you for your help
    Attached Files Attached Files

+ 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. Replace Macro recorded code with more effective code
    By scaffdog845 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2014, 01:09 AM
  2. Make recorded macro loop
    By cowannbell in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 01-11-2013, 09:53 AM
  3. How to create a loop for recorded macro?
    By Partisano in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-30-2012, 12:03 PM
  4. how can i loop this code to reduce the repetition?
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-11-2010, 04:22 AM
  5. Mod macro recorded code
    By usr789 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2007, 09:27 AM

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