Excel VBA Macro to Grouping Records of the Same Date in Main Sheet from Sub 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
'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
--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------
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.