Skip to main content

Posts

Showing posts with the label Clear Content of selected range including formulas

Macro That Automatica​lly Updates Data Itself,Clear Content of selected range In Excel

Macro That Automatica​lly Updates Data Itself In Excel If you need to have a database that automatically updates itself.  In fact, if you have a folder with different excel files, say folder Y (all the same form/template), and the first X cells of these files need to be extracted to another excel workbook (file Z). Every file represents 1 row in workbook  Z. But this should be done automatically. So if I copy a new excel file in folder Y, the first X of this new excel file should automatically (can be with a ‘button demand’)  be copied into workbook Y. Option Explicit Const cstFolder = "C:\Users\ATC0155\Documents\Toolbox\Excel\1208 20 selfupdate" Const cstCols = 5 Sub DoUpdate() Dim wks As Worksheet Dim strFile As String Dim appExcel As Excel.Application Dim lngRow As Long ' Prepare the sheet to receive the data Set wks = Sheet1 wks.Cells.ClearContents ' Run through each file in the folder strFile = Dir(cstFolder ...