Forum Discussion
thobenjo
Jun 01, 2022Copper Contributor
How to Split my Data to Different sheet
Experts please see this report , please I need to split the data to different sheets, like data after blank to one sheet then the next data to another etc
How do I do it.
Here is a macro you can run.
Sub Split2Sheets() Dim ws As Worksheet Dim wt As Worksheet Dim rg As Range Application.ScreenUpdating = False Set ws = ActiveSheet Set rg = ws.Range("A1") Do Set wt = Worksheets.Add(After:=Worksheets(Worksheets.Count)) wt.Name = CStr(rg.Offset(0, 1).Value) rg.CurrentRegion.Copy Destination:=wt.Range("A1") Set rg = rg.End(xlDown).End(xlDown) Loop Until rg.Row = ws.Rows.Count Application.ScreenUpdating = True End Sub
2 Replies
Here is a macro you can run.
Sub Split2Sheets() Dim ws As Worksheet Dim wt As Worksheet Dim rg As Range Application.ScreenUpdating = False Set ws = ActiveSheet Set rg = ws.Range("A1") Do Set wt = Worksheets.Add(After:=Worksheets(Worksheets.Count)) wt.Name = CStr(rg.Offset(0, 1).Value) rg.CurrentRegion.Copy Destination:=wt.Range("A1") Set rg = rg.End(xlDown).End(xlDown) Loop Until rg.Row = ws.Rows.Count Application.ScreenUpdating = True End Sub
- thobenjoCopper ContributorThank you so much !