travelingwilly
New Member
- Joined
- Jun 19, 2002
- Messages
- 24
I am trying to read a sorted Sheet by the first column and if it is missing a value of One (1) before values in column 1 changes I wish to Insert an Entire Blank row with a Partial Copy the essentials so someone can Add the Missing info. Problem is How do I Select A Row ....
Public Sub chkfirst()
Dim fndlvl1 As Boolean
'Sort Authorizers
Sheets("Authorizers").Activate
ActiveWorkbook.Names.Add _
Name:="WORKA", _
RefersTo:=Range("a2", Range("a2").End(xlDown))
Selection.Sort Key1:=Range("a2"), Order1:=xlAscending, Key2:=Range("c2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
'Load Authorizers
y = ""
With Sheets("Authorizers").Range("WORKA")
For s = 1 To .Count
If CStr(.Cells(s, 1)) <> y Then
chng = False
If fndlvl1 = False Then
Rows(" cstr(s + 1) + ":" + cstr( s + 1) ").Select
Selection.Insert Shift:=xlDown
.Cells(s, 1) = .Cells(s - 1, 1)
.Cells(s, 2) = .Cells(s - 1, 2)
.Cells(s, 3) = "**No LVL#1**"
fndlvl1 = False
chng = True
End If
y = CStr(.Cells(s, 1))
End If
If chng = False And .Cells(s, 7) = 1 Then
fndlvl1 = True
End If
chng = False
Next s
End With
Public Sub chkfirst()
Dim fndlvl1 As Boolean
'Sort Authorizers
Sheets("Authorizers").Activate
ActiveWorkbook.Names.Add _
Name:="WORKA", _
RefersTo:=Range("a2", Range("a2").End(xlDown))
Selection.Sort Key1:=Range("a2"), Order1:=xlAscending, Key2:=Range("c2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
'Load Authorizers
y = ""
With Sheets("Authorizers").Range("WORKA")
For s = 1 To .Count
If CStr(.Cells(s, 1)) <> y Then
chng = False
If fndlvl1 = False Then
Rows(" cstr(s + 1) + ":" + cstr( s + 1) ").Select
Selection.Insert Shift:=xlDown
.Cells(s, 1) = .Cells(s - 1, 1)
.Cells(s, 2) = .Cells(s - 1, 2)
.Cells(s, 3) = "**No LVL#1**"
fndlvl1 = False
chng = True
End If
y = CStr(.Cells(s, 1))
End If
If chng = False And .Cells(s, 7) = 1 Then
fndlvl1 = True
End If
chng = False
Next s
End With