title: Excel VBA Run-time error '438': Object doesn't support this property or method
body: <p>I'm running this code in VBA and I can't figure out where my error is. I keep getting the error message </p>
  
  <blockquote>
    <p>"Run-time error '438': Object doesn't support this property or method". </p>
  </blockquote>
  
  <p>I've searched the internet for solutions but haven't been able to find anything that fixed my problem. </p>
  
  <pre><code> Sub FinalCleanUp()
      Dim wkbk As Workbook
      Dim wksht As Worksheet
      Dim DataSheet As Worksheet
      Dim sheetName As String
  
      sheetName = "Data"
      Set wkbk = ActiveWorkbook
  
      'Delete consolidated data sheet if it already exists
      For Each wksht In wkbk.Sheets
          If wksht.Name = sheetName Then
              wkbk.Sheets(sheetName).Delete
              Exit For
          End If
      Next wksht
  
      'Create new sheet for consolidated data
      wkbk.Sheets.Add Before:=wkbk.Sheets(1)
      Set DataSheet = ActiveSheet
      ActiveSheet.Name = sheetName
  
      'Step through each sheet and copy data to consolidated data sheet
      'ERROR IS SOMEWHERE BELOW HERE
      For Each wksht In wkbk.Sheets
          If wksht.Name &lt;&gt; sheetName Then
              wksht.Activate
              Range(Cells(1, 1), Cells(ActiveSheet.UsedRange.Rows.Count, ActiveSheet.UsedRange.Columns.Count)).Copy
              If wksht = wkbk.Sheets(2) Then
                  DataSheet.Activate
                  Cells(ActiveSheet.UsedRange.Rows.Count, 1).Select
              Else
                  DataSheet.Activate
                  Cells(ActiveSheet.UsedRange.Rows.Count + 1, 1).Select
              End If
              ActiveSheet.Paste
          End If
      Next wksht
  
  End Sub
  </code></pre>
  
  <p>This code is supposed to take data from multiple worksheets and consolidate it into one worksheet. As previously stated, I get a run-time error and no output when I run the macro.</p>