Selection of required data in specified range

     

     

     

  • Some times we need to select required data in the selected range
  •  

     

     

    Find required Date

     

    Private Sub CommandButton1_Click()
    Dim max As Integer
    max = Range("A1").End(xlDown).Row
    For i = 1 To max
    If Cells(i, 1).Value = Date Then
    Cells(i, 1).Interior.ColorIndex = 7
    MsgBox Cells(i, 1).Address
    Exit For
    End If
    Next
    End Sub

     

     

    Fill Blank cells with required data - Remove Other data

     

    Private Sub CommandButton1_Click()
    j = UsedRange.Cells.Count
    For i = 1 To j
    UsedRange.Cells(i).Select
    If IsEmpty(ActiveCell.Value) Then
    ActiveCell.Value = 55555
    Else
    ActiveCell.ClearContents
    End If
    Next
    End Sub

     

     

    HasFormula

     

  • Identify the cells, which consists of formulas
  •  

    Private Sub CommandButton1_Click()
    j = UsedRange.Cells.Count
    Dim i As Long
    For i = 1 To j
    UsedRange.Cells(i).Select
    If Cells(i).HasFormula = True Then
    ActiveCell.Font.Italic = True
    End If
    Next
    End Sub