mercredi 11 novembre 2015

If cells contains sum of two cells

I would like to write a macro which goes through all cells in column and if it finds any formula in cell then it simply ignores this cells and simply 'DO NOTHING'.

I know about HasFormula property in VBA but not really sure it works for cells where I sum two cells simply (for instance, =C4+C5). Here is an example:

'loop (if the cell has formula then loop ignores that cell

   i = 1
   For i = 5 To 100
   If InStr(1, Sheets("Corporate Detailed").Cells(i, "F"), "+") > 0 Then
      could be also used---'If Sheets("Corporate Detailed").Cells(i, "G").HasFormula = True Then
    Else
        'Do some operations
    End If
    Next i

    End Sub

Aucun commentaire:

Enregistrer un commentaire