Two situations in the same column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello from Steved

In Column D1:D1000 I put in Kilometres
What had happened a figure 124,957 was A mistake

I would like to know please if the below is possble Thankyou.

In Column D1:D1000 if the figure is a minus or greater than 5,000
I need to know, I am thinking that in Cell M1 if the above occurs then true
if not it will read normally False, also in D1:D1000 can the cell be
highlighted
maybe the cell background be Blue if not then in Cell M2, M3 and so on to
inform me where the mistakes are. if the above is not possible would you
give me some sugguestions please.

Thankyou for your time on my issue.
 
see if this will work for you

Option Explicit
Dim mg As Range
Dim LastRow As Long
Dim TestFor As Long
Dim cell As Range
Dim CurRow As Range
Sub test()
LastRow = Range("a1").End(xlDown).Row
Set mg = Range("a1:a" & LastRow)
On Error Resume Next
If Not mg Is Nothing Then

For Each cell In mg
Set CurRow = Range("a" & LastRow)
If Range("A" & LastRow).Value < 0 Then
Range("M" & LastRow) = Range("a" & LastRow).Value
With CurRow.Offset(0, 12)
..Interior.ColorIndex = 37
End With
End If
Set CurRow = Range("a" & LastRow)
If Range("A" & LastRow).Value > 5000 Then
Range("M" & LastRow) = Range("a" & LastRow).Value
With CurRow.Offset(0, 12)
..Interior.ColorIndex = 37
End With
End If

LastRow = LastRow - 1
Next cell
Else
End If

End Sub
 
sorry, forgot your data was in column D

Option Explicit
Dim mg As Range
Dim LastRow As Long
Dim TestFor As Long
Dim cell As Range
Dim CurRow As Range
Sub test()
LastRow = Range("D1").End(xlDown).Row
Set mg = Range("D1:D" & LastRow)
On Error Resume Next
If Not mg Is Nothing Then

For Each cell In mg
Set CurRow = Range("D" & LastRow)
If Range("D" & LastRow).Value < 0 Then
Range("M" & LastRow) = Range("D" & LastRow).Value
With CurRow.Offset(0, 9)
..Interior.ColorIndex = 37
End With
End If
Set CurRow = Range("D" & LastRow)
If Range("D" & LastRow).Value > 5000 Then
Range("M" & LastRow) = Range("D" & LastRow).Value
With CurRow.Offset(0, 9)
..Interior.ColorIndex = 37
End With
End If

LastRow = LastRow - 1
Next cell
Else
End If

End Su
 
Hello Gary from Steved

Firstly thankyou.

Gary I am getting a Complie error Syntax error on the line below.

...Interior.ColorIndex = 37

Is their something I should be doing to avoid this error yes I've put it in
the same worksheet, Personal.xls!test
 
it looks like there ma be an extra period in front. make sure there is only
1

..Interior.ColorIndex = 37
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top