Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi Dear Excel Experts;
I need help with my excel macro from all of expert; I need to automate data import in excel whe I recieve a CSV file from production updated daily which i save it in the computer shared drive. HOW TO MAKE the TEXT IMPORT AUTOMATED DAILY IF THERE IS NEW FILE ADDED INTO THE SAME FOLDER LOCATION? - each file saved by Name: Date&Time_Lot No1_Lot No2_machine name_Run No_Process.csv • ( like: 120502141657_PHC4#_A_PHC4G_A_IBE001_0785_Shallow.c sv, 120603215613_PJ25N_A_P5K2#_C_IBE001_0824_Deep.csv) - file is in csv/Comma delimiated format - each file have 14columns A to O and contain 30rows - i only need data from 11 to 30 rows every time - the rows i need are going to be same each time -I need a macro to allow the csv file to be automated/import daily / at least if I press a refresh button -------------------------------------------------------------------------- I want to save automated data in a file name: masterdata.xls Fore each ROW data should be saved in new row below to last saved column. . Example: data from file 120502141657_PHC4# should be saved in column B row 6-25, data from file 120603215613_PJ25N_A should be save in column B row 26, 1206703215613_PJ2XN_C should be saved in column B and Row 46 onward. I have recorded a macro to import the data to excel via excel Text Import Wizard. -------------------------------------------------------------------------- Sub Button1_Click() ' ' Button1_Click Macro ' ' Range("B6").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;H:\WYKO\120502141657_PHC4#_A_PHC4G_A_IBE001_ 0785_Shallow.csv", _ Destination:=Range("$B$6")) .Name = "120502141657_PHC4#_A_PHC4G_A_IBE001_0785_Shal low" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 936 .TextFileStartRow = 11 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = True .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With ActiveWindow.SmallScroll Down:=3 Range("B26").Select ActiveWindow.SmallScroll Down:=-12 With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;H:\WYKO\120503215613_PJ25N_A_P5K2#_C_IBE001_ 0824_Deep.csv", Destination _ :=Range("$B$26")) .Name = "120503215613_PJ25N_A_P5K2#_C_IBE001_0824_Deep " .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .TextFilePromptOnRefresh = False .TextFilePlatform = 936 .TextFileStartRow = 11 .TextFileParseType = xlDelimited .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileTabDelimiter = True .TextFileSemicolonDelimiter = True .TextFileCommaDelimiter = True .TextFileSpaceDelimiter = True .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) .TextFileTrailingMinusNumbers = True .Refresh BackgroundQuery:=False End With ActiveWindow.SmallScroll Down:=-3 End Sub -------------------------------------------------------------------------- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to import CSV file from fixed directory | Excel Programming | |||
Help with macro. Import text file (fixed width) | Excel Programming | |||
Import data from other Excel file if file ends with "[directory][filename].xls" | Excel Programming | |||
auto file path update when excel sheet moved to another directory. | Excel Discussion (Misc queries) | |||
Import *.asc file into excel fixed width | Excel Programming |