How to split master data into multiple sheets using VBA

Pubblicato il: 26 aprile 2020
sul canale di: Programming Notes
2,025
21

How to split the master spreadsheet into multiple sheets using VBA?
In this video, you will learn how to split data in excel into multiple sheets using VBA?

Sub Split_data()
Dim iRow As Integer
Dim Uniqe_Data As Integer
Dim Rng As Range

'for getting unique field data
Set Rng = Sheet1.Range("D2:D" & Sheet1.Cells(Rows.Count, "D").End(xlUp).Row)
Rng.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheet1.Range("M1"), Unique:=True
Uniqe_Data = Sheet1.Cells(Rows.Count, "M").End(xlUp).Row

For iRow = 2 To Uniqe_Data
'applying autofilter
Sheet1.Range("A1:G1").AutoFilter Field:=4, Criteria1:=Sheet1.Range("M" & iRow).Value
'sheet add
Sheets.Add After:=Sheets(Sheets.Count)
'Rename sheet name
Sheets(Sheets.Count).Name = Sheet1.Range("M" & iRow).Value
'Copy Data
Sheet1.Range("A1").CurrentRegion.SpecialCells(xlCellTypeVisible).Copy
'Paste data on new added sheet
Sheets(Sheets.Count).Range("A1").PasteSpecial (xlPasteValues)

Next iRow
Sheet1.AutoFilterMode = False
Application.CutCopyMode = False
MsgBox "Data has been separated.", vbInformation
End Sub

Website name
AVIT Guru

Website URL
http://www.avitguru.com/

Registration Form
http://www.avitguru.com/avit-guru-cou...

Course URL
Advanced Excel & MIS
http://www.avitguru.com/advanced-exce...

VBA MAcro Automation
http://www.avitguru.com/online-traini...

MS Access Database
http://www.avitguru.com/ms_access_dat...


In questa pagina del sito puoi guardare il video online How to split master data into multiple sheets using VBA della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Programming Notes 26 aprile 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,025 volte e gli è piaciuto 21 spettatori. Buona visione!