ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Two situations in the same column (https://www.excelbanter.com/excel-programming/340866-two-situations-same-column.html)

Steved

Two situations in the same column
 
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.

Gary Keramidas[_2_]

Two situations in the same column
 
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


--


Gary


"Steved" wrote in message
...
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.




Gary Keramidas[_2_]

Two situations in the same column
 
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

--


Gary


"Steved" wrote in message
...
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.




Steved

Two situations in the same column
 
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

"Gary Keramidas" wrote:

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

--


Gary


"Steved" wrote in message
...
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.





Gary Keramidas[_2_]

Two situations in the same column
 
steve:
go ahead and email me so i can send you something back

--


Gary


"Steved" wrote in message
...
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

"Gary Keramidas" wrote:

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

--


Gary


"Steved" wrote in message
...
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.







Gary Keramidas[_2_]

Two situations in the same column
 
it looks like there ma be an extra period in front. make sure there is only
1

..Interior.ColorIndex = 37
--


Gary


"Steved" wrote in message
...
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

"Gary Keramidas" wrote:

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

--


Gary


"Steved" wrote in message
...
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.







Steved

Two situations in the same column
 
Thankyou Gary I've done as you requested.

"Gary Keramidas" wrote:

steve:
go ahead and email me so i can send you something back

--


Gary


"Steved" wrote in message
...
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

"Gary Keramidas" wrote:

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

--


Gary


"Steved" wrote in message
...
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.








All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com