G
Guest
I have a database in Excel that we use to generate log numbers, log summary
data, track forms, etc.
I am trying to create a method of looking for a certain number in one column
and if it exists, look at another column to find the highest number used, so
that I can create a new "addendum" for that one number (see below)
28735 0
28736 0
28737 0
28737 1
28737 2
28737 3
28737 4
28738 0
28739 0
and so on
I have created a piece of code to do this, but it doesn't work right. It
finds the number, looks at the offset location but sequences wrong and
continues the loop
(28737 0 / 28737 1/ 28737 0 / 28737 1 / 28737 2 / 28737 0 /
28737 1 28737 2 / 28737 3 / 28737 0 / and so on.
The code is as follows:
Sub TestAddendum()
Dim i as long
Dim lastrow as Long
Dim a, Row as Integer
Dim Rng as Range
LastRow = Range("A10000").End(xlup).row
a=Inputbox("Enter the EO number")
Set Rng = Coulmns(2).Find(a)
For i=1 to Last Row
For row = 0 to i +1
If Rng<> 0 then
MsgBox a & " " & Rng.Offset(row,1)
End If
Next Row
Next i
End Sub
Any help would be greatly appreciated.
Thanks in advance
data, track forms, etc.
I am trying to create a method of looking for a certain number in one column
and if it exists, look at another column to find the highest number used, so
that I can create a new "addendum" for that one number (see below)
28735 0
28736 0
28737 0
28737 1
28737 2
28737 3
28737 4
28738 0
28739 0
and so on
I have created a piece of code to do this, but it doesn't work right. It
finds the number, looks at the offset location but sequences wrong and
continues the loop
(28737 0 / 28737 1/ 28737 0 / 28737 1 / 28737 2 / 28737 0 /
28737 1 28737 2 / 28737 3 / 28737 0 / and so on.
The code is as follows:
Sub TestAddendum()
Dim i as long
Dim lastrow as Long
Dim a, Row as Integer
Dim Rng as Range
LastRow = Range("A10000").End(xlup).row
a=Inputbox("Enter the EO number")
Set Rng = Coulmns(2).Find(a)
For i=1 to Last Row
For row = 0 to i +1
If Rng<> 0 then
MsgBox a & " " & Rng.Offset(row,1)
End If
Next Row
Next i
End Sub
Any help would be greatly appreciated.
Thanks in advance