+ Reply to Thread
Results 1 to 4 of 4

Macro copying values and sheet names of all activated sheets

Hybrid View

Rosixks Macro copying values and... 09-06-2011, 01:34 PM
JBeaucaire Re: Macro copying values and... 09-06-2011, 08:21 PM
Rosixks Re: Macro copying values and... 09-07-2011, 01:50 PM
JBeaucaire Re: Macro copying values and... 09-07-2011, 06:16 PM
  1. #1
    Registered User
    Join Date
    09-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Macro copying values and sheet names of all activated sheets

    Hi!
    I am desperate to find a solution for my Workbook, for which I need to create a macro. My problem is that i don't really have much experience with macros. I really hope you can help me! That's the situation:

    I am creating a summary sheet for a document with over 100 sheets with the following characteristics:
    - Not all the sheets are activated
    - All the sheets have different names
    - All the sheets are structured in the same way

    I need a macro to copy the values of a cell range from all the activated sheets and paste them in the summary sheet. It should be able to:

    - Copy values of I9:N9 from all the sheets and paste them in...
    D5:I5(values of sheet 1)
    D6:I6(values of sheet 2)
    D7:I7 (values of sheet 3)
    D8:I8 (values of sheet 4)
    D9:I9 (values of sheet 5)... and so on

    - Copy sheet name of activated sheets and paste them on a list on summary sheet starting at C5

    The summary sheet already exits and it's called "RESUMEN" (I already have some other information and formulas running on "RESUMEN"). I am interested in ...
    ...Copying only cells values because they are actually formulas
    ...Copying only from activated sheets, since I have some inactive sheets that I use as drafts for other macros

    I would be really glad if someone could help me! Thank you so much!!!!!!!!!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro copying values and sheet names of all activated sheets

    If by "inactive" you mean "hidden", then this should do it:
    Option Explicit
    
    Sub CreateSummary()
    Dim ws As Worksheet, wsSUM As Worksheet, NR As Long
    
    Set wsSUM = Sheets("RESUMEN")
    NR = 5
    
        For Each ws In Worksheets
            If ws.Name <> "RESUMEN" And ws.Visible = xlSheetVisible Then
                wsSUM.Range("C" & NR) = ws.Name
                wsSUM.Range("D" & NR).Resize(, 6).Value = ws.Range("I9:N9").Value
                NR = NR + 1
            End If
        Next ws
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    4

    Re: Macro copying values and sheet names of all activated sheets

    Hi JBeaucaire! Thanks so much for you Help!!! It is really working as I needed. You made my day

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro copying values and sheet names of all activated sheets

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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