Results 1 to 11 of 11

VBA code to copy and paste data in one sheet from multiple sheet and loop through

Threaded View

  1. #1
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    62

    Thumbs up VBA code to copy and paste data in one sheet from multiple sheet and loop through

    I am trying copy data in column B for all of the sheets for 2006-2013 to all years sheet. I tried making this code which only does for one year. Is there is any way i can automate this so that the copies data from all the sheets and paste in all years according to years. I am not really that good with VBA just learning. I want to keep using xldown for the code though as it is an requirement for my work

    Sub CreateSheet()
    
    ' Add sheet allyears
    
    Sheets.Add.Name = "allyears"
       
    End Sub
    
    
    Private Sub RunTask1()
    
    'copy data from 2006 to allyears
    
    Sheets("year2006").Activate
    Range("A11:B11").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Sheets("allyears").Activate
    ActiveCell.PasteSpecial xlPasteValues
    ActiveSheet.Select
    Columns("A").ColumnWidth = 25
    ActiveSheet.Rows.AutoFit
    
    End Sub
    Attached Files Attached Files
    Last edited by Farhasnat; 12-27-2021 at 08:38 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA Code for Multiple sheet Pivot Table Data copy and paste to another sheet
    By neeraj1418 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2021, 06:46 AM
  2. For Loop to Copy Paste Data from sheet to another
    By stein7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2019, 04:56 AM
  3. VBA code to read data and paste in other sheet using a loop.
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-21-2018, 03:01 PM
  4. [SOLVED] How to write a code within a loop to copy and paste rows on to another Sheet
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2014, 08:40 PM
  5. [SOLVED] VBA Code to copy data from one sheet and paste to multiple other sheets
    By JimmyG. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2013, 04:25 AM
  6. Replies: 1
    Last Post: 03-28-2013, 02:49 PM
  7. copy paste data with multiple selected ranges from sheet to sheet
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2011, 02:45 PM

Tags for this Thread

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