title: Excel Macro / Module assistance - How to write a code to autofit Cell width
body: <p>I got a module/macro for Excel form this site: [Macro to send email of Excel content][1] The macro works, except the cells are too small for large amount of data in each cell, how do i write a script within the code to adjust the width of the cell accordingly with the data that is inside the cell. The cells vary in terms of the amount of data. Thanks!</p>
  
  <pre><code>Sub Send_Row()
        ' Don't forget to copy the function RangetoHTML in the module.
        ' Working in Office 2000-2010
  Dim OutApp As Object
  Dim OutMail As Object
  Dim cell As Range
  Dim rng As Range
  Dim Ash As Worksheet
  
  Set Ash = ActiveSheet
  On Error GoTo cleanup
  Set OutApp = CreateObject("Outlook.Application")
  
  With Application
      .EnableEvents = False
      .ScreenUpdating = False
  End With
  
  For Each cell In Ash.Columns("B").Cells.SpecialCells(xlCellTypeConstants)
      If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) = "yes" Then
  
          Ash.Range("A1:AE100").AutoFilter Field:=2, Criteria1:=cell.Value
  
          With Ash.AutoFilter.Range
              On Error Resume Next
              Set rng = .SpecialCells(xlCellTypeVisible)
              On Error GoTo 0
          End With
  
          Set OutMail = OutApp.CreateItem(0)
  
          On Error Resume Next
          With OutMail
              .To = cell.Value
              .Subject = "CSI"
              .HTMLBody = RangetoHTML(rng)
              .Display  'Or use Send
          End With
          On Error GoTo 0
  
          Set OutMail = Nothing
          Ash.AutoFilterMode = False
      End If
  Next cell
  
         cleanup:
  Set OutApp = Nothing
  With Application
      .EnableEvents = True
      .ScreenUpdating = True
  End With
        End Sub
  </code></pre>