+ Reply to Thread
Results 1 to 2 of 2

VBa to automate macro formatting

  1. #1
    Registered User
    Join Date
    11-26-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    12

    VBa to automate macro formatting

    Hi I am using a macro to copy paste :
    Range("A160:C161").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("A73").Select
    ActiveSheet.Paste
    Range("A76").Select
    ActiveSheet.Paste
    Range("A79").Select
    ActiveSheet.Paste
    Range("A82").Select
    ActiveSheet.Paste
    Range("A85").Select
    ActiveSheet.Paste
    Range("A88").Select
    ActiveSheet.Paste
    Range("A91").Select
    ActiveSheet.Paste
    Range("A94").Select
    ActiveSheet.Paste
    Range("A97").Select
    ActiveSheet.Paste
    Range("A100").Select
    ActiveSheet.Paste
    Range("A103").Select
    ActiveSheet.Paste
    Range("A106").Select
    ActiveSheet.Paste
    Range("A109").Select
    ActiveSheet.Paste
    Range("A112").Select
    ActiveSheet.Paste
    Range("A115").Select
    ActiveSheet.Paste
    Can this be automated so that I do not need to change or write the range all the time.
    I have a sheet with 3000 records and it is quite time consuming going every 100 records to change the range.

    Any ideas?

    Thanks

    Webisti

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: VBa to automate macro formatting

    If they are always increasing in multiples of three rows, or always increasing by a set number of rows (A1, A3, A5, A7 one day, A4, A8, A12, A16 another) then you could set an offset and loop it for however many times you need

    untested pseudocode but this is the idea
    Please Login or Register  to view this content.
    note: if it is not 3 rows skipped every time you would do something like this:

    Please Login or Register  to view this content.
    I would also set a variable for what cell you are looking to start in. you could do that with an offset of a particular cell and use a formula to give the offset, then use that formulas value as the offset

    Or something

    Last edited by Speshul; 07-24-2014 at 09:24 AM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

+ 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. Is it possible to automate formatting?
    By KMM 80525 in forum Excel General
    Replies: 8
    Last Post: 12-14-2012, 08:47 AM
  2. Macro to Automate Report by Case Number and Product Type (Macro Recorder Fail)
    By maxutility in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2012, 10:39 PM
  3. Replies: 4
    Last Post: 08-17-2011, 01:04 AM
  4. automate the copying of formulas and cell formatting
    By peri1224 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-01-2009, 12:03 PM
  5. How to Automate Conditional formatting
    By zinojohn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2009, 01:22 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