+ Reply to Thread
Results 1 to 3 of 3

Repeating macro

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Repeating macro

    Hello everyone. This should be a fairly easy thing to change and programme. I have a macro that I recorded, where I start at collum AT, adds 8 collums to the left and then copy-pastes the formulas from collums J to Q in there. Now, I want this macro to then be prepared to repeat this inset->copy->paste action on a new collum that's 11 collums to the right (in this case, that would be collum BK). Then, every time I run the macro, it will do these actions on +11 colum than it started off.

    As it is now, it just keeps repeating this action on collum AT, constantly inserting more collums and pasting the info.

    Could anyone help modify the macro, please? Thank you very much.





    Sub Macro2()
    '
    ' Macro2 Macro
    '
    ' Keyboard Shortcut: Ctrl+a
    '
    Columns("AT:AT").Select
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("AB2:AI3").Select
    Range("AI2").Activate
    Selection.Copy
    ActiveWindow.SmallScroll ToRight:=11
    Range("AT2").Select
    ActiveSheet.Paste
    Range("AT3:BA3").Select
    Application.CutCopyMode = False
    Selection.AutoFill Destination:=Range("AT3:BA1260")
    Range("AT3:BA1260").Select
    ActiveWindow.SmallScroll ToRight:=11
    Range("BL2").Select
    End Sub

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Repeating macro

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    06-03-2013
    Location
    Lisbon
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Repeating macro

    Like this?

    Please Login or Register  to view this content.
    I'm not sure what this does but if you say it's easier to work with, then ok.

+ 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. Repeating Macro
    By jackuspi2010 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2013, 07:00 AM
  2. creating a repeating formula that doesn't show repeating values
    By cybershot in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-09-2010, 06:12 PM
  3. repeating macro
    By maacmaac in forum Excel General
    Replies: 1
    Last Post: 11-09-2006, 12:25 PM
  4. [SOLVED] Repeating Macro
    By Dino in forum Excel General
    Replies: 3
    Last Post: 02-19-2006, 12:50 AM
  5. Repeating Macro
    By Dino in forum Excel General
    Replies: 3
    Last Post: 02-15-2006, 12:10 AM

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