msgbox on each value..
This will do what you're asking for, but it lacks any flexibility.
Public Sub CompareData():
Dim rCell As Range
Dim nDiff As Long
With ActiveSheet.Range("B2:D6")
For Each rCell In .Cells
With rCell
nDiff = .Value - .Offset(10, 0).Value
If nDiff < 0 Then _
MsgBox LCase(.Address(False, False)) & "-" & _
LCase(.Offset(10, 0).Address(False, False)) & " " & _
UCase(.Parent.Cells(.Row, 1).Text) & _
" has worked " & Format(Abs(nDiff), "0 hours ") & _
Choose(Sgn(nDiff) + 2, "more ", , "less ") & _
"than she wrote at " & _
.Parent.Cells(1, .Column) & "."
End With
Next rCell
End With
End Sub
I'll leave the potential gender confusion to you...
In article ,
AND wrote:
Yes, I think it's a very good method, but my chief asked to me to find right
that kind of solution for our question: a popup for each discrepancie.
Thank a lot for your help, but i'm looking for a solution yet.
--
BBB
"JE McGimpsey" wrote:
Not sure why you're after that particular method, but based on your
layout, an easy alternative way to see discrepancies would be to:
- Select B12:D16, with cell B12 the active cell
- Choose Format/Conditional Formatting, and enter:
CF1: Cell Value is not equal to =B2
Format1: <pattern/<red
- Click OK
Any discrepant cells will then be highlighted in red.
In article ,
AND wrote:
hello,
I have this kind of data(num):
A B C D
1 AKDTA AKTIM AKAVZ
2 Paul 10 12 16
3 Maggie 4 1 16
4 Debora 87 112 21
5 Sarah 98 6 2
6 Andrew 515 58 21
7
8
9
10
11 AKDTA AKTIM AKAVZ
12 Paul 10 12 16
13 Maggie 4 1 16
14 Debora 87 114 21
15 Sarah 98 6 2
16 Andrew 515 58 65
I need a VBA scrip to get a MSGBOX for each different value from its
correspondent, when I click a button.
ES:
c4-c12 DEBORA has worked 2 hours more than she wrote at AKTIM.
d6-d14 ANDREW has worked 44 hours more than she wrote at AKAVZ
can you help me please?
thanks a lot !!
|