S
ste mac
Bit of help please, essentially the three macro's below do the same thing
ie find a number in a range.
eg find250 = look in the range see if 250 is there, tell me where it is...etc
The problem, there was 250000 found in the range and it told where, but
it also said 250 and 5000 where also in the same place! I presume this
is because 250 is in '250'000 and 5000 is also in 2'5000'0 so it gives the
same location for all three when they are located in different places...
Can this be resolved so the location of 250 is the real location
same for 5000 and 250000...
Thanks for any help
ste
Sub find250()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R24").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S16").Value = rng1.Row - 1
Else
ActiveSheet.Range("S16").Value = 0
End If
find5000
End Sub
Sub find5000()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R25").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S17").Value = rng1.Row - 1
Else
ActiveSheet.Range("S17").Value = 0
End If
find250000
End Sub
Sub find250000()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R26").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S18").Value = rng1.Row - 1
Else
ActiveSheet.Range("S18").Value = 0
End If
End Sub
ie find a number in a range.
eg find250 = look in the range see if 250 is there, tell me where it is...etc
The problem, there was 250000 found in the range and it told where, but
it also said 250 and 5000 where also in the same place! I presume this
is because 250 is in '250'000 and 5000 is also in 2'5000'0 so it gives the
same location for all three when they are located in different places...
Can this be resolved so the location of 250 is the real location
same for 5000 and 250000...
Thanks for any help
ste
Sub find250()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R24").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S16").Value = rng1.Row - 1
Else
ActiveSheet.Range("S16").Value = 0
End If
find5000
End Sub
Sub find5000()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R25").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S17").Value = rng1.Row - 1
Else
ActiveSheet.Range("S17").Value = 0
End If
find250000
End Sub
Sub find250000()
Dim lastrow As Long, rng As Range, rng1 As Range
Sheets("Locations").Range("P2").Select
lastrow = ActiveSheet.Range("S28").Value + 1
Set rng = Range("P1" & lastrow)
Set rng1 = rng.Find(Range("R26").Value)
If Not rng1 Is Nothing Then
ActiveSheet.Range("S18").Value = rng1.Row - 1
Else
ActiveSheet.Range("S18").Value = 0
End If
End Sub