View Single Post
 
Old 02-18-2023, 01:44 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Code:
Option Explicit

Sub RiteData()
    
    Dim wkSht As Worksheet
    Dim nextRow As Long
    Dim lRow As Long
    Dim i As Integer
    Dim celltxt As String
    
    lRow = Sheets("Main").Cells(Rows.Count, "B").End(xlUp).Row
    Application.ScreenUpdating = False
    For Each wkSht In Sheets
    Sheets("Main").Activate
        For i = 2 To lRow
            celltxt = Sheets("Main").Range("B" & i)
            If Sheets("Main").Range("A" & i).Value = wkSht.Name Then
                Sheets("Main").Activate
                wkSht.Activate
                nextRow = wkSht.Range("A" & Rows.Count).End(xlUp).Row + 1
                Sheets("Main").Range("B" & i).Copy Destination:=wkSht.Range("A" & nextRow)
                Sheets("Main").Range("B" & i) = ""

             End If
        Next i
    
    Next wkSht
    Sheets("Main").Activate
    Sheets("Main").Range("A1").Select
    
    Application.ScreenUpdating = True
End Sub
Attached Files
File Type: xlsm Write To Own Sheets.xlsm (21.2 KB, 1 views)
Reply With Quote