I am working on a script that checks for data in column B. It places an incremental number in column A until it notices that there is no more data. I thought I had this working Wednesday but today, for some reason isn't doing anything when I try to execute the macro. BOM is the name of the sheet. This is semi-related to another post that I made :
http://www.excelforum.com/excel-prog...ror-400-a.html

They are both part of a template that I'm using to automate my Bill of Materials sheet. If it would help, I could attach the whole template.

Sub ItemNumber()

'Automatically numbers rows with data

Dim nCount   As Long
Dim nLastRow As Long

nLastRow = Sheets("BOM").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
nCount = 1
  
  For r = 7 To LastRow
            Sheets("BOM").Cells(r, 1) = nCount
            nCount = nCount + 1
  Next r
End Sub