Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Compare values in columns & display missing values in a new | Excel Discussion (Misc queries) | |||
How do i compare values from two sheet and copy & paste if values match? | Excel Programming | |||
Compare Listbox values with Collection values | Excel Programming | |||
compare values between workbooks and copy values | Excel Programming |