Results 1 to 12 of 12

Cleaning and Consolidating Multiple Worksheets

Threaded View

  1. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cleaning and Consolidating Multiple Worksheets

    VKS,
    This code should work, but you need to have heading in each sheet as you now have in the first sheet. In sheet C, you also need to have values in column C, as you now have in sheet1. I have tested it in product sheet as you have all the data.
    Sub Split_Sheet_Name1()
    Dim i As Long, LR As Long, k As Long
    Application.ScreenUpdating = False
    
    On Error Resume Next
        
    For i = 1 To Sheets.Count
     With Sheets(i)
            Sheets(i).Range("A2").Value = Trim(Split(Sheets(i).Name, "-")(0))
            Sheets(i).Range("B2").Value = Trim(Split(Sheets(i).Name, "-")(1))
        
            LR = .Cells(.Rows.Count, 3).End(xlUp).Row
            For k = 2 To LR
                If .Cells(k, 3).Value <> "" Then
                    If .Cells(k, 2).Value = "" Then
                    .Cells(k, 2).Value = .Cells(k - 1, 2).Value
                    .Cells(k, 1).Value = .Cells(k - 1, 1).Value
                    End If
                End If
            Next k
    End With
    Next i
    Application.ScreenUpdating = True
    End Sub
    Last edited by AB33; 12-31-2012 at 05:12 AM.

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