I have the following macros that require a loop in an Excel-2007 table. There are several columns in the table and I am currently getting the right column status using the index
property columns.
The only way to use the index me correctly Fannam
object I am hoping that the better option is to use specific columns using the column name / header . How can I do this and this can also be done?
In addition, in general, is there a better way to create this loop?
Worksheets ( "Lists") Kijhekt select the files, such as object as Finem named as the name of the file Dim String Dim Nyafail coil index as integer as lackluster new Shitcolindaks set files such Taiaimport = Aktivsait Klist object ( "Tibisosaffail") NewFileColIndex = FilesToImportkListColumn ( "new file name"). ; - Can this be different? Is there any better way in filesToImport.ListRows // for each file? If InStr (fName.Range (1, call), "DATE") & lt; & Gt; 0 then // fName.Range (1 column = Change to rename FFG line to use fileNameWithDate (required, newFileColIndex) .Value, "DATE", _ Format (ThisWorkbook.names ( "ValDate"). RefersToRange, "yyyymmdd")) wbName = OpenCSVFIle (fPath & amp; fileNameWithDate) CopyData sourcefile: = CSTR (fileNameWithDate), destFile: = destFile, destSheet: = "temporary" means final next fName2
< / Div>
If you want to find a specific value in a column header, you can find the method. The search method provides a limit, which you can use in the context of the performance of the rest of the operation. There are a lot of alternative parameters for the search method, if you need to make more changes to this, read it on in the help docs.
dim cellsToSearch as range set as range dim searchValue string as dim foundColumn foundColumn = cellsToSearch.Find: ( "D1 A1") 'check here set their cells To do the searchValue = "Whatever you are looking for here goes" set cellsToSearch = Sheet1.Range (what: = searchValue)
Comments
Post a Comment