• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

vba code correction

r@1234

Member
Code:
Sub STEP1()
   Dim Wb1 As Workbook
   Application.ScreenUpdating = False
   Set Wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Files\AlertCodes.xlsx")
   Set Ws1 = Wb1.Worksheets.Item(2)
   With Ws1
      Ws1.Sheets.Cells.Clear
   Wb1.Close True
  
End With

End Sub

i am getting error while clearing all the data in Ws1 i get stuck from this line Ws1.Sheets.Cells.Clear
plz correct the code and help me in solving this problem sir
 
Just removing the useless :​
Code:
Sub STEP1()
         Application.ScreenUpdating = False
    With Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\Files\AlertCodes.xlsx")
        .Worksheets(2).UsedRange.Clear
        .Close True
    End With
         Application.ScreenUpdating = True
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Thnx Alot Fluff13 & Marc L Sir for helping me in solving this problem Sir
Problem Solved
Have a Great Day Sir
 
Back
Top