View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default count of changed data



"ton de w" wrote:

Hello,
I am using a macro to lower case selected areas.
How can I correctly print the number of cells changed, rather than
visited?

Sub lowerme()
Dim cell As Object
Dim count As Integer
count = 0
changed = 0
For Each cell In Selection
oldvalue = cell.Value
count = count + 1
cell.Value = LCase(cell.Value)
if oldvalue < cell.value then
changed = changed + 1
end if
Next cell
MsgBox count & Changed
End Sub

TIA

Ton