ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro for cells that are less than 1 and conditioned on another ce (https://www.excelbanter.com/excel-discussion-misc-queries/229245-macro-cells-less-than-1-conditioned-another-ce.html)

frenchdaddy

Macro for cells that are less than 1 and conditioned on another ce
 
Trying to write a macro that takes a range of cells (J45:J2546) and checks to
see if any of the cells in this range are less than 1. But it needs to
verify that there is number greater than 1 in column A of the same row.
Then I need it to insert the number 1,000 into that cell.

Something sort of like .... IF J45<1 AND A1, then insert 1,000.

If anyone has suggestions, Thanks!!!!

Gary''s Student

Macro for cells that are less than 1 and conditioned on another ce
 
Sub dural()
Dim r As Range
Set r = Range("J45:J2546")
For Each rr In r
If rr.Value < 1 And rr.Offset(0, -9).Value 1 Then
rr.Value = 1000
End If
Next
End Sub

--
Gary''s Student - gsnu200850


"frenchdaddy" wrote:

Trying to write a macro that takes a range of cells (J45:J2546) and checks to
see if any of the cells in this range are less than 1. But it needs to
verify that there is number greater than 1 in column A of the same row.
Then I need it to insert the number 1,000 into that cell.

Something sort of like .... IF J45<1 AND A1, then insert 1,000.

If anyone has suggestions, Thanks!!!!


frenchdaddy

Macro for cells that are less than 1 and conditioned on anothe
 
Thanks a million, that was exactly what I needed.

"Gary''s Student" wrote:

Sub dural()
Dim r As Range
Set r = Range("J45:J2546")
For Each rr In r
If rr.Value < 1 And rr.Offset(0, -9).Value 1 Then
rr.Value = 1000
End If
Next
End Sub

--
Gary''s Student - gsnu200850


"frenchdaddy" wrote:

Trying to write a macro that takes a range of cells (J45:J2546) and checks to
see if any of the cells in this range are less than 1. But it needs to
verify that there is number greater than 1 in column A of the same row.
Then I need it to insert the number 1,000 into that cell.

Something sort of like .... IF J45<1 AND A1, then insert 1,000.

If anyone has suggestions, Thanks!!!!



All times are GMT +1. The time now is 02:27 AM.

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