I have a problem. I feel comfortable writing the code, and then explain it, here it is written: Turn on the Diff OpenWare worksheet set = ActiveWorkbook path = "C: \ pathto \" pfile = split ("File1, File2, File3", ",") myH EDG = path from the Jammu = 0 to the eidings = Split ("Januari, February, Tuesday, April, Major, Juni, Julie, August, September, October, November, December", ","); Pfile (j) & amp; ".xlsx" i = 0 If IsFile (pathtwo) = true then set IBound (myHeadings) with I = 0 openWb = workbooks. Open (pathtwo) OpenWs = openWb.Sheets (myHeadings (i)) if openWs.Range ("C34") = 0 then current WB. Sheets ("Indet"). Room (70, i + 27 + 12 * J.well = "" Other Current Vib. Sheet ("Indet") Room (70, i + 27 + 12 * J). Value = OpenW.Range ("C 34 ") If the end is for the workbook (Open W. NEM) then the next end is done.Click on the next j end What do I want to choose from the file from the Pfile list, all my headings Run again through all the sheets defined in and decrease the value on C34 (Actually many more values are cut, but it is To keep me in.) After this I want to close the file, file the file to go to the next file and do all the same to all three files (again, in reality, some of them still do not exist ). The function "IsFile" Stackoverflow, in this thread: I have a reason That is why I present my data to the current WB AA 70 (line 70, column) 27) I want to start writing on Jammu * 12 is because it is "periodic" based on the file (file 1 file corresponds to 2015, file 2 to 2016 etc.), and so in my summary I have the month and month of the month. The problem occurs when I run this macro, in the first file in the sheet, I get the planet Mars out of range, but before I add the repetition of the files, there is no limit Was the first file anybody who could see how it could be? Please note that indentation and so on can be closed to some extent because I copied it from a very large file in the middle of the irrelevant code with several rows.
function returns IsFile (fname as string) in the form of boolean 'if the name provided indicates an existing file If it's wrong, start again, start again Start again, return Firefox, or if it is a folder, then endfile = (GetAttr (fName) and vb directory) written on ISEFlop. & Lt; & Gt; Vb directory)
currentWb.Sheets ("Indata"). Cell (70, i + 27 + 12 * j) Value = openWs.Range ("C34")
This is not the right answer for your specific question but in this way I did something similar and this Can help you see how I did it. Actually what this is doing is opening a CSV and is copying the whole sheet and pasting it into a workbook.
Regarding the Dir ()
You can file with two arguments or without any argument. You start it with 2 arguments of path and attributes (which Is optional). The second time when I call Dir in this suburb, then there is no logic. What does this bring up later files
sub add_Sheets () Set the worksheet dim wb workbook in the form of a lower worksheet as wb = Application.Workbooks.Open ("C : \ Users \ Desktop \ CSV \ All.xlsx ") 'where you want a workbook for the workbook for Strawfile = Dir (" C: \ User \ Desktop \ csv \ .csv "), the place where all the CSVs were Do lane (strfile) & gt; 0 debug.print strawfile app Workbook Set the Open ("c: \ Users \ Desktop \ CSV \" and StrFile) ws = ActiveSheet ws.Range ("A1: C" and Rows.Count). Content on selection of worksheet. Copy wb.Activate wb.Worksheets.add (after: = the worksheets.count) name = StrFile 'CASP File Range ("A1") Setting the name of sheet. Paste Special Paste: = xlPasteValues StrFile = Dir Loop Ending Sub
No comments:
Post a Comment