Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cesar Gonzalez   on Sep 21 In MS Office Category.

  
Question Answered By: Alisha Johnson   on Sep 21

Once we thought to use a round function we got it done. Thanks for
the help. I'm posting the entire script below in case anyone else
comes along trying to do this.

Selecting the top left corner of a table, it goes through and
compares each cell  to the one below it, deleting the matches and
placing the differences into parentheses rounded to one decimal
point.

Sub DataCompareDecimal()
Dim x As Integer

Do While ActiveCell.Value <> ""

Do While ActiveCell.Value <> ""
x = x + 1
If ActiveCell.Offset(1, 0) = ActiveCell.Value Then

ActiveCell.Offset(1, 0).Value = ""
ActiveCell.Offset(0, 1).Activate


Else
ActiveCell.Offset(1, 0).Value = "'" & "(" & Round
(ActiveCell.Offset(1, 0).Value, 1) & ")"
ActiveCell.Offset(0, 1).Activate

End If

Loop

ActiveCell.Offset(2, -x).Activate
x = 0

Loop

End Sub

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Add ( ) to cell contents Or get search suggestion and latest updates.


Tagged: