Maria Clara
New Member
Hi Guys, I'm using the code below to split data into multiple sheets but instead of splitting it in the same sheet I'd like it to be split in a new workbook. I mean, open a new workbook for each cell value informed.
Could anyone help me on this?
thank you!!!!
Could anyone help me on this?
thank you!!!!
Code:
Sub Splitdatatosheets()
Application.ScreenUpdating = False
Dim rng As Range
Dim rng1 As Range
Dim vrb As Boolean
Dim sht As Worksheet
Set rng = Sheets("FINAL AWARD").Range("K2")
Set rng1 = Sheets("FINAL AWARD").Range("A2:K2")
vrb = False
Do While rng <> ""
For Each sht In Worksheets
If sht.Name = Left(rng.Value, 31) Then
sht.Select
Range("A1").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("FINAL AWARD").Range("A1:K1").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