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
RWomanizer Posts 365 Registration date Monday February 7, 2011 Status Contributor Last seen September 30, 2013 - Mar 18, 2011 at 01:26 AM
Related:
- Excel help with macro
- Spell number in excel without macro - Guide
- Excel marksheet - Guide
- Excel free download - Download - Spreadsheets
- Macros in excel download - Download - Spreadsheets
- Excel date format dd.mm.yyyy - Guide
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
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
for each sheet in sheets
' copy for copying content and pasting content
'next
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
120
Mar 18, 2011 at 01:26 AM
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