[COLOR="Navy"]Sub[/COLOR] MG03Jul59
[COLOR="Navy"]Dim[/COLOR] Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Ws [COLOR="Navy"]As[/COLOR] Worksheet
[COLOR="Navy"]Dim[/COLOR] sht [COLOR="Navy"]As[/COLOR] Worksheet
[COLOR="Navy"]Dim[/COLOR] nRng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] nnRng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] Col [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Dim[/COLOR] c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Integer[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]On[/COLOR] [COLOR="Navy"]Error[/COLOR] [COLOR="Navy"]Resume[/COLOR] [COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]If[/COLOR] Sheets("Total_Sheets").Select = False [COLOR="Navy"]Then[/COLOR]
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Total_Sheets"
[COLOR="Navy"]Set[/COLOR] sht = ActiveSheet
bypass:
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]On[/COLOR] [COLOR="Navy"]Error[/COLOR] GoTo 0
Col = 0
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Ws [COLOR="Navy"]In[/COLOR] Worksheets
[COLOR="Navy"]If[/COLOR] Not Ws.Name = "Total_Sheets" [COLOR="Navy"]Then[/COLOR]
[COLOR="Navy"]With[/COLOR] Ws
[COLOR="Navy"]Set[/COLOR] Rng = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
c = c + 1
[COLOR="Navy"]If[/COLOR] IsDate(Dn) [COLOR="Navy"]Then[/COLOR] [COLOR="Navy"]Exit[/COLOR] For
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]With[/COLOR] Sheets("Total_Sheets")
Lst = .Range("A" & .Rows.Count).End(xlUp).Offset(1).Row
[COLOR="Navy"]Set[/COLOR] nRng = Rng.Offset(c - 1).Resize(Rng.Count - c + 1, 3)
nRng.Copy .Range("A" & Lst).Resize(nRng.Rows.Count, 3)
[COLOR="Navy"]Set[/COLOR] nnRng = Rng.Offset(c - 1, 3).Resize(Rng.Count - c + 1, 2)
nnRng.Copy .Range("D" & Lst).Offset(, Col).Resize(nnRng.Rows.Count, 2)
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] If
Col = Col + 2
c = 0
[COLOR="Navy"]Next[/COLOR] Ws
[COLOR="Navy"]With[/COLOR] Sheets("Total_Sheets")
.Range("A1").Resize(, 23) = Array("Date", "Account", "Details", "Withdrawal" _
, "Deposit", "Withdrawal", "Deposit", "Withdrawal", "Deposit", "Withdrawal" _
, "Deposit", "Withdrawal", "Deposit", "Withdrawal", "Deposit", "Withdrawal" _
, "Deposit", "Withdrawal", "Deposit", "Withdrawal", "Deposit", "Withdrawal", "Deposit")
[COLOR="Navy"]Set[/COLOR] Rng = .Range(.Range("A2"), .Range("A" & Rows.Count).End(xlUp)).Resize(, Col)
Rng.Sort .Range("A2"), xlAscending
Rng.Columns.AutoFit
[COLOR="Navy"]End[/COLOR] With
MsgBox "Run!!"
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]