View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Lars-Åke Aspelin[_4_] Lars-Åke Aspelin[_4_] is offline
external usenet poster
 
Posts: 83
Default macro to generate next number

On Tue, 9 Mar 2010 13:26:01 -0800, Mike H
wrote:

A macro it is then

Sub Sonic()
Dim LastRow As Long
Set SrcSht = Sheets("Sheet2")
Set DstSht = Sheets("Sheet1")
LastRow = SrcSht.Cells(Cells.Rows.Count, "A").End(xlUp).Row
DstSht.Range("A1").Value = SrcSht.Range("A" & LastRow)
End Sub


+1 should be added at the end of the last statement like this:

DstSht.Range("A1").Value = SrcSht.Range("A" & LastRow) + 1

Lars-Åke