Hi YLB,
Two different questions. Yup.
For the scrolling problem: Insert a sheet in your workbook. Click in the blank cell at the top left corner of the sheet, between 'A' and '1' to select all the cells in your Sheet "Record Creator". Click 'Copy'. Change to the new sheet. Click 'PasteSpecial' and select 'All'. Delete the original sheet "Record Creator" and rename the new sheet "Record Creator". Set the zoom to 70% to match your example. Save the sheet.
Note: Don't use "Move or Copy a Sheet'. Do as above.
Worked for me.
And for your incrementing part numbers:
Try this one on a COPY of your workbook;
Option Explicit
Sub KillTheDupes()
Dim Cel As Range
Dim LastRow As Long
Dim Iposition As Long
Dim OldFormula As String
Dim NewFormula As String
'errors?
'On Error GoTo endo
'speed
Application.ScreenUpdating = False
'get last row data
LastRow = Range("W65536").End(xlUp).Row
'check all
For Each Cel In Range("W3:W" & LastRow)
'test for blank
If Cel = "" Then GoTo nextcel
'if match do stuff to change it
If Cel = Cel.Offset(1, 0) Then
'get old formula
OldFormula = Cel.Offset(1, 0).Formula
'find 'LEFT(I##' in formula USING (I
Iposition = InStr(OldFormula, "(I")
'Check the number of digits in the row number, increment
' the 'I' string and then concat formula back together, place it
If Cel.Row + 1 < 10 Then
'if we're row 9 or less
NewFormula = Left(OldFormula, Iposition + 3) & _
Mid(OldFormula, Iposition + 4, 1) + 1 & _
Right(OldFormula, Len(OldFormula) - (Iposition + 4))
'put revised fromula in cell
Cel.Offset(1, 0).Formula = NewFormula
ElseIf Cel.Row + 1 < 100 Then
'if we're in row 10 to 99
NewFormula = Left(OldFormula, Iposition + 4) & _
Mid(OldFormula, Iposition + 5, 1) + 1 & _
Right(OldFormula, Len(OldFormula) - (Iposition + 5))
Cel.Offset(1, 0).Formula = NewFormula
ElseIf Cel.Row + 1 < 1000 Then
'if we're in row 100 to 999
NewFormula = Left(OldFormula, Iposition + 5) & _
Mid(OldFormula, Iposition + 6, 1) + 1 & _
Right(OldFormula, Len(OldFormula) - (Iposition + 6))
Cel.Offset(1, 0).Formula = NewFormula
'ElseIf
'if we're in row 1000 to 9999
'....etc...
End If
End If
nextcel:
Next Cel
'reset
Application.ScreenUpdating = True
Exit Sub
endo:
'reset
Application.ScreenUpdating = True
End Sub
I also posted some suggestions at Oz, re the Subsitute code. Now that I've seen the sheet tho perhaps some VBA to create the part numbers 'on the fly' might be better.
Cheers,
dr