vba - Blank Rows On Specialized Import -
I have data that is coming every day, this is the script that I put together in the set to add the first empty cell Have compromised. When I run it, the script correctly pastes it into the empty cells, but there are several hundred in between, probably thousands of blank lines.
'sub Read_CSV_Files () Dim sPath string dim oPath, oFile as, Ofso objects such as DIM R, Aiaro Long Dim wbImportFile as Workbook Dim wsDestination As Worksheet' files Place sPath = 'insert path here. Set wsDestination = ThisWorkbook.Sheets ( "raw data") R = Cells.SpecialCells (xlCellTypeLastCell) .Offset (1, 0) .Row set oFSO = CreateObject ( "Scripting.FileSystemObject") set oPath = oFSO.GetFolder (sPath) application .ScreenUpdating then each oFile false = oPath.Files LCase (right (oFile.Name, 4)) = ".csv" then "open Workbooks.OpenText file name file to import: = oFile.Path, Genesis : = 65001, StartRow: = 2, data type = XlDelimited, _ TextQualifier = XlDoubleQuote, ConsecutiveDelimiter: = false, comma: = true, FieldInfo = array (1, 1), _ TrailingMinusNumbers: = true set wbImportFile = ActiveWorkbook for iRow = 1 to wbImportFile .Sheets (1) .UsedRange.Rows.Cou nt wbImportFile.Sheets (1) .Rows (iRow) .Copy wsDestination.Rows (R) R = r + 1 Next iRow wbImportFile.Close false set wbImportFile = nothing to end next oFile End Sub I am still very new, this script was mixed by mixing it together. Any help on this forum would be appreciated. Based on the incredible nature of to this: .UsedRange , I want to change your code This part of:
wbImportFile.Sheets (1) for iRow = 1. Range used Rows. Account wbImportFile.Sheets (1) Krahe (iRow) Kpeepi wsDestination.Rows (R) R = r + 1 Next iRow
IRow = 1 to wbImportFile.Sheets (1) .Range (& rsquo; rows for 'A'). (XlUp). Line wbImportFile.Sheets (1) .ows (iRow). Copy r = wsDestination.Range ("A" and Rows.Count). End (xlUp) .Row + 1 WsDestination.Range ("A" & R) Paste Special IRO
Comments
Post a Comment