+ Reply to Thread
Results 1 to 4 of 4

help marco with a for loop

Hybrid View

  1. #1
    Registered User
    Join Date
    03-27-2019
    Location
    suisse
    MS-Off Ver
    excel 2016
    Posts
    2

    help marco with a for loop

    Hello,

    I need your help for a macro, with a "for" loop, that goes form cells 60 to 40. For example, in the first iteration, I will be copying cells O60 to V60 and pasting them in cells G59 to N59.
    For iteration 2, I will be copying cells O59 to V59 and pasting them in cells G58 to N58...

    Below is what I have done so far, but doesn't seem to work :/
    There is obviously a problem this the formulation of: Range("O61:V61" - i)

    Sub Macro1()
    '
    ' Macro1 Macro

    For i = 1 To 20

    Range("O61:V61" - i).Select
    Selection.Copy
    Range("G60" - i).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Next

    End Sub


    Thanks for your help

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,331

    Re: help marco with a for loop

    Welcome to the forum...Please take some time and read the forum rules...Once correcting your post with code #, someone will be able to assist...

    Like this....

    Sub Macro()
       'Code here......
    End sub
    Last edited by sintek; 03-28-2019 at 01:08 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,318

    Re: help marco with a for loop

    Hi deadlyfrezzee,

    Could you please apply code tags as requested!

    Thanks...
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    03-27-2019
    Location
    suisse
    MS-Off Ver
    excel 2016
    Posts
    2

    Re: help marco with a for loop

    Thanks, this will spare me some hours of work

+ 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. How to create a Marco to run same Marco run on everysheet.
    By chriskingkiller in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-09-2013, 02:53 AM
  2. Hello I'm Marco
    By marcziii in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-08-2013, 08:07 PM
  3. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  4. Run marco of a source file in the source file via marco of a master patch file
    By freeman6479 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2012, 10:55 AM
  5. Marco Loop Question
    By DaGo21 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-27-2006, 08:12 AM
  6. help me with this marco
    By lwong in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2006, 09:01 PM
  7. Marco Help
    By schlempyasst in forum Excel General
    Replies: 0
    Last Post: 05-05-2005, 10:57 AM
  8. Marco Help
    By schlempyasst in forum Excel General
    Replies: 0
    Last Post: 05-04-2005, 07:30 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