Monday, September 10, 2012

Excel VBA Macro to Segregate Data From One Sheet To Many

Excel VBA Macro for Segregating Data From One Sheet To Many
Sub Data_Seg()
Dim X As Integer
Dim y As Integer
Dim z As Integer
Dim a As Integer
Dim b As Integer
Dim C As Integer

a = 1

For X = 2 To 100
If Sheets("sheet2").Cells(X, 8) <> "" Then
Sheets.ADD.Name = Sheets("Sheet2").Cells(X, 8)
'Cells(x,8)having the names on which we create the Sheets'

For z = 2 To 100
If InStr(LCase(Sheets("sheet2").Cells(z, 1)), LCase(Sheets("sheet2").Cells(X, 8))) Then
a = a + 1

For b = 1 To 6 ' Cell having the data to segregate'
ActiveSheet.Cells(a, b) = Sheets("sheet2").Cells(z, b)
ActiveSheet.Cells(1, b) = Sheets("sheet2").Cells(1, b)
ActiveSheet.Cells(1, b).Font.Bold = True
Next b

End If
Next z

For C = 2 To 100
If ActiveSheet.Cells(C, 4) <> "" Then
ActiveSheet.Cells(2, 5) = C - 1
ActiveSheet.Cells(2, 6) = ActiveSheet.Cells(2, 6) + ActiveSheet.Cells(C, 4)
End If
Next C

End If
a = 1   ‘To make in every sheet data beginning from first row’
Next X
End Sub

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog