REM : This subroutine creates counting from a given cell location. Sub ginti() Dim Source As Range Set Source = Selection q = Source.Text 'Source.Value = 3 'Source.Value = 4 With Source .Value = 1 .AutoFill .Resize(q, 1), xlFillSeries End With End Sub Sub mdInsulationCheck() Dim Source As Range Dim errFlag As Boolean Dim errCount As Integer ' Dim iCol As Long Dim nCol As Long Dim iRow As Long Dim nRow As Long Dim total As Double ' By default, there is no error. errFlag = False errCount = 0 Set Source = Selection nCol = Source.Columns.Count nRow = Source.Rows.Count For iRow = 1 To nRow x = Source.Rows(iRow).Columns(1).Address x2 = Source.Rows(iRow).Columns(nCol).Address sumx = Source.Rows(iRow).Columns(1 - 4).Address sumx2 = Source.Rows(iRow).Columns(0).Address Range(sumx & ":" & sumx2).Select tempSum = WorksheetFunction.Product(Selection) For tempcol = 1 To nCol If (Source.Rows(iRow).Columns(tempcol).Value = tempSum Or Source.Rows(iRow).Columns(tempcol).Value = "") Then Else errFlag = True errCount = errCount + 1 Range(Source.Rows(iRow).Columns(tempcol).Address).Select Selection.Interior.Color = RGB(255, 100, 100) MsgBox "ERROR in " & Source.Rows(iRow).Columns(tempcol).Address ' Exit Sub End If Next tempcol Next iRow If errFlag = False Then MsgBox "Calculation is OK" Else MsgBox CStr(errCount) + " Errors found", vbCritical, "Mar Gaye - Errors found." End If End Sub