Results 1 to 8 of 8

Split data from Master Sheet to existing worksheets and overwrite data

Threaded View

vmwest Split data from Master Sheet... 03-21-2013, 11:07 AM
AB33 Re: Split data from Master... 03-21-2013, 11:39 AM
vmwest Re: Split data from Master... 03-21-2013, 02:18 PM
vmwest Re: Split data from Master... 03-21-2013, 02:48 PM
arlu1201 Re: Split data from Master... 03-21-2013, 02:46 PM
AB33 Re: Split data from Master... 03-21-2013, 03:52 PM
vmwest Re: Split data from Master... 03-21-2013, 05:21 PM
AB33 Re: Split data from Master... 03-21-2013, 05:36 PM
  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    tampa, fl
    MS-Off Ver
    Excel 2010
    Posts
    4

    Split data from Master Sheet to existing worksheets and overwrite data

    Hi All,

    I'm new to macros and was hoping someone here could help me out. I'm currently using the code (found it on one of these forums) below to split data based on criteria in column A from a master workseet onto several existing worksheets (One tab for each salesman). This code works great but adds the data to the first non-blank row in the existing sheets. I would like for it to overwrite any data as this workbook is updated monthly and should only reflect current month activity. Any help would be greatly appreciated!!


    Sub Split() 
        Dim rng As Range 
        Dim rng1 As Range 
        Dim vrb As Boolean 
        Dim sht As Worksheet 
        Set rng = Sheets("Total").Range("A4") 
        Set rng1 = Sheets("Total").Range("A4:H4") 
        vrb = False 
        Do While rng <> "" 
            For Each sht In Worksheets 
                If sht.name = Left(rng.Value, 31) Then 
                    sht.Select 
                    Range("A2").Select 
                    Do While Selection <> "" 
                        ActiveCell.Offset(1, 0).Activate 
                    Loop 
                    rng1.Copy ActiveCell 
                    ActiveCell.Offset(1, 0).Activate 
                    Set rng1 = rng1.Offset(1, 0) 
                    Set rng = rng.Offset(1, 0) 
                    vrb = True 
                End If 
            Next sht 
            If vrb = False Then 
                Sheets.Add after:=Sheets(Sheets.Count) 
                ActiveSheet.name = Left(rng.Value, 31) 
                Sheets("Total").Range("A3:H3").Copy ActiveSheet.Range("A1") 
                Range("A2").Select 
                Do While Selection <> "" 
                    ActiveCell.Offset(1, 0).Activate 
                Loop 
                rng1.Copy ActiveCell 
                Set rng1 = rng1.Offset(1, 0) 
                Set rng = rng.Offset(1, 0) 
            End If 
            vrb = False 
        Loop 
    End Sub
    Last edited by arlu1201; 03-21-2013 at 02:46 PM.

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