Saturday 18 August 2012

VB Program - To Delete contents of a column

VB Program - To Delete contents of a column

Program:


'Use of Do Until
'The below code will delete the contents of column A.

Sub Delcontent()

    i = 1
   Cell1 = "A" + CStr(i)
   val1 = Range(Cell1).Value
   Do Until val1 = ""
       Range(Cell1).Select
       Selection.ClearContents
       i = i + 1
      Cell1 = "A" + CStr(i)
      val1 = Range(Cell1).Value
   Loop




Note: Copy the code and run in Microsoft Visual Basic Editor.(Microsoft Excel)

No comments:

Post a Comment