Results 1 to 7 of 7

Worksheet consolidation, VBA. Stop copying column headers

Threaded View

Lifeseeker Worksheet consolidation, VBA.... 02-20-2012, 05:18 PM
watersev Re: Worksheet consolidation,... 02-20-2012, 05:46 PM
Lifeseeker Re: Worksheet consolidation,... 02-20-2012, 05:55 PM
Lifeseeker Re: Worksheet consolidation,... 02-21-2012, 09:39 AM
Lifeseeker Re: Worksheet consolidation,... 02-21-2012, 10:01 AM
watersev Re: Worksheet consolidation,... 02-21-2012, 10:51 AM
Lifeseeker Re: Worksheet consolidation,... 02-21-2012, 10:56 AM
  1. #1
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    Worksheet consolidation, VBA. Stop copying column headers

    Hi there,

    I took another mate's sheet and applied it to my workbook to play around but ran into one problem.

    The copied the range displayed is the header row of the sub worksheet. I double checked the code, but cannot seem to find where the problem is.

    So if you activate the "master" worksheet, all that gets copied over is the column header.

    Anyone able to assist? I must be missing something.

    Option Explicit
    Private Sub Worksheet_Activate()
    Dim ws As Worksheet, LR As Long
    
    Me.UsedRange.Offset(1).Clear
    
    For Each ws In Worksheets
            LR = ws.Range("A" & Rows.Count).End(xlUp).Row
                ws.Range("A2:F" & LR).Copy
                Me.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
    Next ws
    
    LR = Range("A" & Rows.Count).End(xlUp).Row
    With Range("A2:F" & LR)
        .FormatConditions.Delete
        .FormatConditions.Add Type:=xlExpression, Formula1:="=MOD(ROW(),2)=0"
        .FormatConditions(1).Borders(xlTop).Weight = xlThin
        .FormatConditions(1).Borders(xlBottom).Weight = xlThin
        .FormatConditions(1).Interior.ColorIndex = 34
    End With
    
    Columns.AutoFit
    Range("A2").Select
    
    End Sub
    Thanks
    Attached Files Attached Files
    Last edited by Lifeseeker; 02-21-2012 at 10:57 AM. Reason: adding the code in there

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