title: Creating a Serial Number based upon values in a table
body: <p>I am having difficulty coming up with this code. I know enough vba to get myself in trouble. What I am trying to do is to generate serial numbers for shelf locations. I want it to be able to auto generate the numbers based upon certain parameters and rules. So in a warehouse there are certain  rows, shelves, and positions. If I was to put in a table the number of each of them e.g.</p>
  
  <p>3 Rows
  2 Shelves
  4 Positions </p>
  
  <p>I would want it to spit out the relevant serial numbers based upon how many rows/shelves/positions there are. In this case it would be:</p>
  
  <p>R01-S01-P01,
  R01-S01-P02,
  R01-S01-P03,
  R01-S01-P04,
  R01-S02-P01,
  R01-S02-P02,
  R01-S02-P03,
  R01-S02-P04,
  R02-S01-P01,
  R02-S01-P02,
  R02-S01-P03,
  R01-S01-P04,
  R01-S02-P01,
  etc...</p>
  
  <p>Any thoughts or help you can give would be greatly appreciated!</p>
  
  <pre><code>Dim i As Integer, iPos As Integer, c As Integer, iRow As Integer, d As Integer, iShl As Integer
  
  iPos = Worksheets("Sheet1").Cells(3, "J").Value
  iShl = Worksheets("Sheet1").Cells(3, "I").Value
  iRow = Worksheets("Sheet1").Cells(3, "H").Value
  For i = 1 To iPos * iShl * iRow
   Cells(i, 3).Value = i
      For d = 1 To iShl
          Cells(i, 2).Value = d
              For c = 1 To iRow
                  Cells(c, 1).Value = i
              Next c
      Next d
  Next i
  </code></pre>