Excel VBA : Auto Generating Unique Number for each row
<p>I got a requirement for auto filling the row with unique number starting from some value(say 1000).</p>

<ul>
<li><p>The sheet has 2 columns. </p></li>
<li><p>When ever I fill a value in 2nd column in each row the first column should auto filled.</p></li>
<li><p>I have filled 3 rows(1000,1001,1002). </p></li>
<li><p>Now if i delete the middle row that has the auto generated value as 1001, the row that was initially with the value 1002 gets automatically updated to 1001.</p></li>
<li><p>But according to my requirement the value should remain unique(it should remain as 1002).</p></li>
</ul>

<p>Formula that i used is:</p>

<pre><code>=IF(B2&lt;&gt;"",COUNTA($B$2:B2)+999,"")
</code></pre>

<p>My excel is like this before deleting the value:</p>

<pre><code>Test_Case_Id    Name
1000             a
1001             b
1002             c
</code></pre>

<p>After deleting the middle row it becomes:</p>

<pre><code>Test_Case_Id    Name
1000             a
1001             c
</code></pre>

<p>Expected Result:</p>

<pre><code>Test_Case_Id    Name
1000             a
1002             c
</code></pre>

<p>Please help me in this.</p>

<p>Thanks,
Vevek</p>