Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Compare values in columns & display missing values in a new cpetta Excel Discussion (Misc queries) 1 April 2nd 05 05:51 AM
How do i compare values from two sheet and copy & paste if values match? rozb Excel Programming 0 March 5th 04 12:06 AM
Compare Listbox values with Collection values Stuart[_5_] Excel Programming 2 September 20th 03 01:58 PM
compare values between workbooks and copy values bgardiner Excel Programming 0 September 9th 03 03:54 PM


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"