Consulting

Results 1 to 4 of 4

Thread: Clear the data

  1. #1

    Clear the data

    My file is located in C:\Users\pc\Desktop
    my file name is demo.xlsx
    macro will be added in a different file excluding demo.xlsx
    file is not opened so open the file by vba clear all the data in column A and Column B and save the file and close it

  2. #2
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi rider!
    Sub test()
    Dim pth$
    pth = "C:\Users\pc\Desktop\demo.xlsx"
    Application.ScreenUpdating = False
      Workbooks.Open pth
      ActiveSheet.Range("a:b") = ""
      ActiveWorkbook.Close True
    Application.ScreenUpdating = True
    End Sub

  3. #3
    I think this code contains error it is not working
    i am not getting error but after runing the macro it is processing but 5min have been passed but still it is unable to process
    my data is not big i think code has an error plz have a relook Sir

  4. #4
    VBAX Newbie
    Joined
    Mar 2019
    Posts
    2
    Location
    Sub Doit()
        Workbooks.Open Filename:="C:\Users\pc\Desktop\demo.xlsx"
        Set wb = ActiveWorkbook
        [a:b].ClearContents
        wb.Save
        wb.Close
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •