+ Reply to Thread
Results 1 to 3 of 3

Copy/Paste Cells and put into new sheets

  1. #1
    Registered User
    Join Date
    06-21-2011
    Location
    England
    MS-Off Ver
    2013
    Posts
    48

    Copy/Paste Cells and put into new sheets

    Hello all,

    I need some help on a task I need to carry out. I am attaching a sample file.
    What I want to do is to copy some columns in order to run some regressions. So, for example i need to copy the columns of aug-96 and sep-96 from the sheet "main" and put them in a new sheet called "sep-96", then copy column sep-96 and oct-96 and paste them in a new sheet called "oct-96", and so on... (I need the second column of each month, not the one with the date on it).

    Thanks for your time,

    Costas
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Copy/Paste Cells and put into new sheets

    hi, Costasg, please check attachment, run code "test", hope this helps
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    06-21-2011
    Location
    England
    MS-Off Ver
    2013
    Posts
    48

    Re: Copy/Paste Cells and put into new sheets

    Hi watersev,

    Thanks a lot for your help (once again). Now, in the new sheets I would like to delete the rows that contain "DIV". I found a macro, but it can be used only for the active sheet. How can i transform it to apply to all sheets (except the main)?

    Many thanks again.


    PHP Code: 
    Sub DeleteRows()

        
    Application.ScreenUpdating False
        Application
    .EnableEvents False
        Application
    .Calculation xlCalculationManual
        
        Dim SearchCriteria 
    As String:   SearchCriteria "DIV"
        
        
    ActiveSheet.Range("A1").Activate
        On Error 
    GoTo FoundAll
        Dim CriteriaRow 
    As Long
        CriteriaRow 
    Cells.Find(What:=SearchCriteriaAfter:=ActiveCellLookIn:=xlFormulas_
                        LookAt
    :=xlPartSearchOrder:=xlByRowsSearchDirection:=xlNext_
                        MatchCase
    :=FalseSearchFormat:=False).Row
        
        
    While CriteriaRow 0
            ActiveSheet
    .Rows(CriteriaRow ":" CriteriaRow).Delete shift:=xlUp
            On Error 
    GoTo FoundAll
            CriteriaRow 
    Cells.Find(What:=SearchCriteriaAfter:=ActiveCellLookIn:=xlFormulas_
                            LookAt
    :=xlPartSearchOrder:=xlByRowsSearchDirection:=xlNext_
                            MatchCase
    :=FalseSearchFormat:=False).Row
        Wend
        
    GoTo FoundAll
        
    FoundAll
    :
        
    Application.Calculation xlCalculationAutomatic
        Application
    .EnableEvents True
        Application
    .ScreenUpdating True
        
    Exit Sub
        
    End Sub 

+ 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