+ Reply to Thread
Results 1 to 6 of 6

problem with macro in a repetitive task

  1. #1
    Registered User
    Join Date
    01-03-2011
    Location
    earth
    MS-Off Ver
    2010
    Posts
    35

    problem with macro in a repetitive task

    Hi,
    Consider I have these numbers in cells:
    Please Login or Register  to view this content.
    Now I want to attach group 2 and 3 to the right of group 1. So
    Please Login or Register  to view this content.
    I record a macro first (with relative reference) and places group 2 to the right of group 1. Then I stop the macro recording and select group 3. After running the macro, I saw that group 3 is placed right to the group 2 (and not group 1).
    Please Login or Register  to view this content.
    Any idea about that?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: problem with macro in a repetitive task

    Use your mouse to highlight this column of values, then run this macro:

    Please Login or Register  to view this content.

    As per your example, it uses the blank cells in between each group to note specific "groups" (called AREAS) and copies them one at a time next to the first "group" in your selection.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: problem with macro in a repetitive task

    Please Login or Register  to view this content.



  4. #4
    Registered User
    Join Date
    01-03-2011
    Location
    earth
    MS-Off Ver
    2010
    Posts
    35

    Re: problem with macro in a repetitive task

    JBeaucaire, thanks it works fine.

    snb, when I run your code, I get runtime error 1004. Can you please state what is the procedure? maybe I did wrong.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: problem with macro in a repetitive task

    Are the data in column A ?

  6. #6
    Registered User
    Join Date
    01-03-2011
    Location
    earth
    MS-Off Ver
    2010
    Posts
    35

    Re: problem with macro in a repetitive task

    I tested with column A and it works. Thanks,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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