Generate serial numbers

Yes.. but it is giving out some errors with locked input sheet.. I can't send you the file from my office... Is there any other way than Google drive..!?
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try amending the top of code as below:-
Code:
With Sheets("Input Sheet")
    .Unprotect Password:="mick"
    Set Rng = .Range(.Range("E2"), .Range("E" & Rows.Count).End(xlUp))
End With

And place this at the end of the code

Code:
Sheets("Input Sheet").Protect Password:="mick"

If you want to send the file try "Box.net" or "DropBox"
 
Last edited:
Upvote 0
Try this for results on sheet "Check Sheet".
Code:
Sub Check_sheet()
Dim Rng As Range, Dn As Range, nRng As Range, R As Range, Rr As Range
Dim RwMax As Long, Rw As Long, Ac As Long, n As Long
With Sheets("Input Sheet")
    .Unprotect Password:="ABCD1234"
    Set Rng = .Range(.Range("E2"), .Range("E" & Rows.Count).End(xlUp))
End With
Sheets("Check Sheet").Range("C7:M67").ClearContents

For Each Dn In Rng
If Not Dn.Value = "VARIANT" Then
    If nRng Is Nothing Then Set nRng = Dn Else Set nRng = Union(nRng, Dn)
End If
Next Dn
Rw = 1
For Each Rr In nRng.Areas
RwMax = Application.Max(Rr.Offset(, 1).Value) + 1
ReDim Ray(1 To RwMax, 1 To Rr.Count * 2)
   
   For Each R In Rr
        If R.Offset(, 1) <> "" Then
            Ac = Ac + 2
            Ray(1, Ac - 1) = R.Value
           For n = 1 To R.Offset(, 1).Value
            Ray(n + 1, Ac - 1) = n
            Next n
        
        End If
    Next R
With Sheets("Check Sheet").Range("c7").Offset(Rw).Resize(RwMax, Ac)
  .Value = Ray
End With
Rw = Rw + RwMax + 5
Ac = 0
Next Rr
Sheets("Input Sheet").Protect Password:="ABCD1234"
End Sub
 
Upvote 0
Try this:-
Code:
Sub Check_sheet()
Dim Rng As Range, Dn As Range, nRng As Range, R As Range, Rr As Range
Dim RwMax As Long, Rw As Long, Ac As Long, n As Long
With Sheets("Input Sheet")
    .Unprotect Password:="ABCD1234"
    Set Rng = .Range(.Range("E2"), .Range("E" & Rows.Count).End(xlUp))
End With
Sheets("Check Sheet").Range("C7:M65").ClearContents
For Each Dn In Rng
If Not Dn.Value = "VARIANT" Then
    If nRng Is Nothing Then Set nRng = Dn Else Set nRng = Union(nRng, Dn)
End If
Next Dn
'Rw = 1
For Each Rr In nRng.Areas
RwMax = Application.Max(Rr.Offset(, 1).Value) + 1
ReDim Ray(1 To RwMax, 1 To Rr.Count * 2)
   
   For Each R In Rr
        If R.Offset(, 1) <> "" Then
            Ac = Ac + 2
            Ray(1, Ac - 1) = R.Value
           For n = 1 To R.Offset(, 1).Value
            Ray(n + 1, Ac - 1) = n
            Next n
        
        End If
    Next R
With Sheets("Check Sheet").Range("c7").Offset(Rw).Resize(RwMax, Ac)
  .Value = Ray
End With
Rw = 38
Ac = 0
Next Rr
Sheets("Input Sheet").Protect Password:="ABCD1234"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,851
Messages
6,121,931
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top