clear all the data

L

Legacy 451409

Guest
vba is placed in a seperate file macro.xlsm
my file name sample1.xlsx
we have to open the file by vba and clear all the data of sheet1 and save and close the file
all files are loacted in same place
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,394
Office Version
365
Platform
Windows
How about
Code:
Sub andy124()
   Dim Wb As Workbook
   Application.ScreenUpdating = False
   Set Wb = Workbooks.Open(ThisWorkbook.Path & "\sample1.xlsx")
   Wb.Sheets("Sheet1").Cells.Clear
   Wb.Close True
End Sub
 
L

Legacy 451409

Guest
Thnx Fluff Sir for giving ur precious time and Great Support to this post
Have a Great Day Sir
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
33,394
Office Version
365
Platform
Windows
You're welcome & thanks for the feedback
 

Forum statistics

Threads
1,084,780
Messages
5,379,834
Members
401,630
Latest member
lisa83rtt

Some videos you may like

This Week's Hot Topics

Top