+ Reply to Thread
Results 1 to 3 of 3

Repeating Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2013
    Location
    Ipswich , England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Repeating Macro

    Hi

    I have the following macro
    PHP Code: 
    Sub Macro2()
    '
    Macro2 Macro
    '

    '
        
    Range("B1:D1").Select
        Selection
    .AutoFill Destination:=Range("B1:D2"), Type:=xlFillDefault
        Range
    ("B1:D2").Select
    End Sub 
    I need something on the end of this macro to make it repeat itself all the way down column B for a set number of rows. Im sure this is simple but cant seem to get it.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Repeating Macro

    Hi, jackuspi2010,

    assuming that in Column A are values which deztermine the way down to copy the data:
    Sub Macro2re()
    '
    ' Macro2 Macro
    '
    
    '
        Range("B1:D1").AutoFill Destination:=Range("B1:D" & Cells(Rows.Count, "A").End(xlUp).Row), Type:=xlFillDefault
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    03-15-2013
    Location
    Ipswich , England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Repeating Macro

    that worked perfectly thankyou very much.

+ 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