title: Save last row number as variable after opening the workbook for the later use
body: <p>I want to save the last row number used in a particular sheet at <code>Workbook_Open()</code> for the later use in other modules.
  So far I have this code:</p>
  
  <p>ThisWorkbook:</p>
  
  <pre><code>Public last_row as long
  
  Private Sub Workbook_Open()
      last_row = Worksheets("Sheet1").Cells(Rows.count, 1).End(xlUp).Row
      MsgBox ("This is the last row number: " &amp; last_row)
  End Sub
  </code></pre>
  
  <p>I get the pop-up message correctly, like "This is the last row number: 25", when I open the workbook. This is a desired output.</p>
  
  <p>Module 1:</p>
  
  <pre><code>Sub ABC()
      MsgBox ("This is the last row number: " &amp; last_row)
  End Sub
  </code></pre>
  
  <p>But when I run the Module 1, "This is the last row number: " message is what I get.</p>
  
  <p>So, I am failing in storing the "<i>last_row</i>" variable as public. What am I doing wrong? Thanks in advance!</p>