Excel help with macro

Closed
Dido - Mar 12, 2011 at 03:49 PM
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - Mar 18, 2011 at 01:26 AM
Hello, guys
i am trying to copy the same cells B3,C3,D3,E3,F3 from 100 worksheets to a master one.
So what i need is a macro that will copy the cells from sheet one in to Master sheet on row 1, then from the next worksheet the same cells in to Master row2 and so on...
Please help me if you know how to do that. Email me at d e y a n @ a l l l e d . c o m
Thanks



Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 14, 2011 at 10:23 AM
you have too loop thru each sheet. for that you can use

for each sheet in sheets

' copy for copying content and pasting content

'next
0
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 120
Mar 18, 2011 at 01:26 AM
Use This
    Sub CopyFromWorksheets()
    Dim wrk As Workbook
    Dim sht, trg As Worksheet
    Dim rng As Range
    Dim colCount As Integer
     
    Set wrk = ActiveWorkbook
     
    Application.ScreenUpdating = False
    worksheets("master").select
     cells.select
      cells.clear
 
    Set trg = worksheets("master")
    Set sht = wrk.Worksheets(1)
    colCount = sht.Cells(1, 255).End(xlToLeft).Column
    With trg.Cells(1, 1).Resize(1, colCount)
        .Value = sht.Cells(1, 1).Resize(1, colCount).Value
        .Font.Bold = True
    End With
         
    For Each sht In wrk.Worksheets
        Set rng = sht.Range(sht.Cells(2, 1), sht.Cells(65536, 1).End(xlUp).Resize(, colCount))
        trg.Cells(65536, 1).End(xlUp).Offset(1).Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value
    Next sht
     
    Application.ScreenUpdating = True
End Sub
0