title: How to format excel spreadsheet cells using Excel Macro Module?
body: <p>I am totally new to MS Excel and VBA Macro. I wanna know how to format cells or have an overall control on the spreadsheet using Macro VB. I have here a very simple code just to illustrate what I want to know.</p>
  
  <p><b><code>macro_format_test.xlsm</code>: </b></p>
  
  <pre><code>Private Sub Worksheet_Activate()
      Me.Unprotect
      Me.Cells.ClearContents
  
      Dim ws As Worksheet
      Set ws = Worksheets("Sheet1")
  
      ws.Cells(1, 1) = "ID"
      ws.Cells(1, 2) = "Name"
      ws.Cells(1, 3) = "Address"
  
      Me.Protect
  End Sub
  </code></pre>
  
  <p>In the codes...</p>
  
  <pre><code>ws.Cells(1, 1) = "ID"
  ws.Cells(1, 2) = "Name"
  ws.Cells(1, 3) = "Address"
  </code></pre>
  
  <p>I want those to appear bold, italized, and centered. I also want to set he column width using codes. How am I gonna do that??? Please help. You can also give me some references regarding this because everytime I try google all I can see are how to add UserForm which I don't need as of now. Thanks in advance.</p>