add one to cell below

G

Guest

I am trying to create an inventory sheet -

Column A - Part Number (always the same) (ex. 10-0A in cell 2A)
Column B - Serial Number (needs to add 1 every new cell (ex. 0001 in cell B2
and needs to be 0002 in cell B3))
Column C - Invoice Description
Column D - Product Details

Is it possible to only add a new line when you start typing 10-0A in cell A3
and have the serial number column B add 1 to be 0002 in that column?

PART NUMBER SERIAL NUMBER INVOICE DESCRIPTION
10-0A 0001

If i click the cell below 10-0A and start typing is it possible to
automatically in the cell under the 0001 in the serial number column to add
+1 to make it 0002?

Thanks,
 
M

Mark Lincoln

I would do this:

Format your column B cells as "0000" in order to see leading zeros.

in B3, type in the following formula:

=IF(A3<>"",B2+1,"")

Copy this formula down Column B as far as you need to.
 
G

Guest

Is there a way for when i print this if only 4 products are on the page to
automatically hit print and not have extra pages print?
 
M

Mark Lincoln

I've amended this a bit from one of my own macros. Some of the experts
on this list might have a more elegant solution. But having said
that....

This assumes no empty rows in the data range.

Dim c as Range
Dim LastRow as Integer
Dim PrintRange as String

Sub PrintDataUnits()
For Each c In Range("A2:A5000").Cells
If (c.Value) = "" Then
LastRow = LTrim(Str(c.Row - 1))
Exit For
End If
Next
PrintRange = "A1:F" & LastRow ' <---Change F to match your last
column
If LastRow <> "1" Then Range(PrintRange).PrintOut
End Sub

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top