![]() |
Compare values
Hi, I would like to compare the values from column A then if the value are smaller than 10 then minus 1 from the values. Is there any codes t do this -- ReD-DevI ----------------------------------------------------------------------- ReD-DevIL's Profile: http://www.excelforum.com/member.php...fo&userid=3262 View this thread: http://www.excelforum.com/showthread.php?threadid=52841 |
Compare values
Hi Red Devil,
Try: '============= Public Sub Tester() Dim SH As Worksheet Dim rng As Range Dim rCell As Range Set SH = ActiveSheet '<<==== CHANGE Set rng = Intersect(SH.UsedRange, SH.Columns(1)) For Each rCell In rng.Cells With rCell If IsNumeric(.Value) Then If .Value < 10 Then .Value = .Value - 1 End If End If End With Next rCell End Sub '<<============= --- Regards, Norman "ReD-DevIL" wrote in message ... Hi, I would like to compare the values from column A then if the values are smaller than 10 then minus 1 from the values. Is there any codes to do this? -- ReD-DevIL ------------------------------------------------------------------------ ReD-DevIL's Profile: http://www.excelforum.com/member.php...o&userid=32624 View this thread: http://www.excelforum.com/showthread...hreadid=528412 |
Compare values
err your codes works perfectly, but i think i phrase my question wrongly. haha actually i have this problem sno equipment ID 1 123 2 124 3 125 4 126 when i remove the number 3 record the number 4 move up but the sno remains as 4 i want it to change to 3 using vba codes. so i thought of this comparing values if those values is smaller than 3 then -1 but it seem that idea don't work. can you suggest any better ideas ? -- ReD-DevIL ------------------------------------------------------------------------ ReD-DevIL's Profile: http://www.excelforum.com/member.php...o&userid=32624 View this thread: http://www.excelforum.com/showthread...hreadid=528412 |
Compare values
In sno column, enter:
=ROW()-1 and copy down. This will auto-number your rows HTH -- AP "ReD-DevIL" a écrit dans le message de ... err your codes works perfectly, but i think i phrase my question wrongly. haha actually i have this problem sno equipment ID 1 123 2 124 3 125 4 126 when i remove the number 3 record the number 4 move up but the sno remains as 4 i want it to change to 3 using vba codes. so i thought of this comparing values if those values is smaller than 3 then -1 but it seem that idea don't work. can you suggest any better ideas ? -- ReD-DevIL ------------------------------------------------------------------------ ReD-DevIL's Profile: http://www.excelforum.com/member.php...o&userid=32624 View this thread: http://www.excelforum.com/showthread...hreadid=528412 |
All times are GMT +1. The time now is 11:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com