Saturday, 8 December 2012

How To Group the Records of the Same Date in Main Sheet

Excel VBA Macro To Grouping Records of the Same Date in Main Sheet
'The Following Macro Pull Out The Records From Sub Sheet and Insert Into Main Sheet
'Based On Date Matching'

 Sub GroupingTransactions()
 Dim X As Integer
 Dim Y As Integer
 Dim z As Integer
 Dim A As Integer

 z = 0

 For X = 2 To 100
 If Sheets("Sub").Cells(X, 1) = "" Then Exit For

 For Y = 2 To 100
 If Sheets("Main").Cells(Y, 1) = "" Then Exit For

 If Sheets("Main").Cells(X + z, 1) = Sheets("Sub").Cells(Y, 1) Then
 z = z + 1
 Sheets("Main").Cells(X + z, 1).EntireRow.Insert
 For A = 1 To 26
 Sheets("Main").Cells(X + z, A) = Sheets("Sub").Cells(Y, A)
 Next A
 End If

 Next Y
 Next X

 End Sub


1 comment:

  1. Thank You Mr.Johnson...Keep on following my Blog......


Hi User, Thank You for Visiting My Blog. Please Post Your Feedback/Comments/Query.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts