• Ask a Question
150
Insert Image Size must be less than < 5MB.
    Ask a Question
    Cancel
    150
    More answer You can create 5 answer(s).
      Ask a Poll
      Cancel
      Participant

      How to clear the content in entire column if before cell is empty/blank??

       

      A              B
      1 ABCD     11
      2 DECE      12
      3                    12
      4                     12
      5                   23

       

      Now I want to clear only b3:b5 only

      Asked by rskumaryellapu on September 9, 2017 in VBA: Macros.
      1 Answers
      Keymaster

      Hello,

       

      Please see the below macro, it will clear the data in the B if they have more rows than A.

       

      Sub ClearUnValidData()
      lRowinColumnA = Range("A1000000").End(xlUp).Row
      lRowinColumnB = Range("B1000000").End(xlUp).Row
      If lRowinColumnB > lRowinColumnA Then
      Range("B" & lRowinColumnA + 1 & ":B" & lRowinColumnB).ClearContents
      End If
      End Sub
      

      Thanks!

      Answered by PNRao on September 10, 2017..