title: Speeding up VBA Code to Run Faster
body: <p>I have an Excel Workbook where the user imports a text file by the click of a button. My code works exactly as I need it to but it is extremely slow when filling in column H, Reading Date. Here is what my Excel Workbook looks like when the text file has been imported to the excel sheet: 
  <a href="https://i.stack.imgur.com/uWtjT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uWtjT.png" alt="enter image description here"></a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>Sub Import_Textfiles()
  Dim fName As String, LastRow As Integer
  
  Worksheets("Data Importation Sheet").Activate
  
  LastRow = Range("A" &amp; Rows.Count).End(xlUp).Row + 1
      ' Finds the first blank row to import text file data to
  fName = Application.GetOpenFilename("Text Files (*.txt), *.txt")
  
  If fName = "False" Then Exit Sub
  
    With ActiveSheet.QueryTables.Add(Connection:="TEXT;" &amp; fName, _
          Destination:=Range("A" &amp; LastRow))
          .Name = "2001-02-27 14-48-00"
          .FieldNames = True
          .RowNumbers = False
          .FillAdjacentFormulas = False
          .PreserveFormatting = True
          .RefreshOnFileOpen = False
          .RefreshStyle = xlInsertDeleteCells
          .SavePassword = False
          .SaveData = True
          .AdjustColumnWidth = False
          .RefreshPeriod = 0
          .TextFilePromptOnRefresh = False
          .TextFilePlatform = 437
          .TextFileStartRow = 2
          .TextFileParseType = xlFixedWidth
          .TextFileTextQualifier = xlTextQualifierDoubleQuote
          .TextFileConsecutiveDelimiter = False
          .TextFileTabDelimiter = True
          .TextFileSemicolonDelimiter = False
          .TextFileCommaDelimiter = False
          .TextFileSpaceDelimiter = False
          .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
          .TextFileFixedColumnWidths = Array(14, 14, 8, 16, 12, 14)
          .TextFileTrailingMinusNumbers = True
          .Refresh BackgroundQuery:=False
      End With
      ActiveWindow.SmallScroll Down:=0
  
  
      Dim strShortName As String
  
  
      'Adding Reading Date to Excel Sheet:
      Dim rowCount As Integer, currentRow As Integer
      Dim sourceCol As Integer, nextCol As Integer
      Dim currentRowValue As String
      Dim fileDate1 As String
      Dim fileDate2 As String
  
      sourceCol = 1 'columnA
      nextCol = 8 'column H
      rowCount = Cells(Rows.Count, sourceCol).End(xlUp).Row
  
      strShortName = fName
      fileDate1 = Mid(fName, InStrRev(fName, "\") + 1)
      fileDate2 = Left(fileDate1, 10)
  
      Cells(LastRow, 9) = ("Updating Location: " &amp; strShortName)
  
      For currentRow = 1 To rowCount
          currentRowValue = Cells(currentRow, nextCol).Value
          If currentRowValue = "" Then
          Cells((currentRow), (nextCol)).Select
          Cells((currentRow), (nextCol)) = fileDate2
          End If
      Next
  
  End Sub
  </code></pre>
  
  <p>If anyone has any suggestions as to how I can speed up the importation of the reading date I would appreciate it greatly! Thanks in advance!</p>