• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Input specific text into an empty row

Hany ali

Active Member
hello every Body,I want your Help in this Problem
in my File I have code for Insert Empty Row Each time you enter a different date .. I want to put Specific Text with Calculation For Debit and Credit In This Row
as You See ,thanks & Best Regards


Marc L

Excel Ninja
Hi !​
The easy beginner way without any code (and even via VBA, whatever) :​
  • no needs to insert blank rows so first delete them.

  • Select your table and use from the Data top tab the SubTotal Excel feature
    you must set on Date column and SUM on Debit & Credit colum …

Marc L

Excel Ninja
I can't understand why as an Excel basics already exists for this job and needing a single codeline only ! (TEBV main rule)
Maybe you need to give us a crystal clear complete explanation and​
attach a raw data workbook (before) and the expected result workbook (after),​
both well reflecting the real workbook so without any comment, arrow, unnecessary color, …​

Hany ali

Active Member
I always want this blank row directly while entering data. Whenever I enter a different date from another, this row is inserted directly

Marc L

Excel Ninja
As a starter (v2) :​
Private Sub Worksheet_Change(ByVal Target As Range)
                 Dim L&
    If Target.Address = Cells(Rows.Count, 5).End(xlUp).Address Then
        If IsDate(Target) And IsDate(Target(0)) Then
            If Target.Value2 <> Target(0).Value2 Then
                     Application.EnableEvents = False
                     Application.ScreenUpdating = False
                     If IsEmpty(Target(-2)) Then L = Target(-1).Row Else L = Application.Max(6, Target(-1).End(xlUp).Row)
                With Target(0).EntireRow
                    .Interior.ColorIndex = 4
                    .Interior.Pattern = xlSolid
                    .Columns("B:C").Formula = "=SUM(B" & L & ":B" & Target(-1).Row & ")"
                    .Cells(4).Value2 = "Total "
                End With
                     Application.ScreenUpdating = True
                     Application.EnableEvents = True
            End If
        End If
    End If
End Sub
Do you like it ? So thanks to click on bottom right Like !​