View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
ajocius[_11_] ajocius[_11_] is offline
external usenet poster
 
Posts: 1
Default VBA - Passing Cell Contents Into Comment


DominicB,
Below is the use of the same code you recommend. I get a run-tim
error 1004 at the .AddComment line. I'm not a proven VBA programme
yet, so the flow may seem not very VBA.

At the top of my program:
----------------------------------------

Dim UserCell As String
Dim CommentVariable As String

Further down the program
---------------------------------------

For Column = 3 To 52 Step 1
SheetCellPrevious2 = Sheets("Previous").Cells(Row
Column).Value
SheetCellCurrent2 = Sheets("Current").Cells(Row
Column).Value
If SheetCellCurrent2 < SheetCellPrevious2 Then
Cells(Row, Column).Select
CommentVariable = Cells(Row, Column).Value
UserCell = ActiveWindow.RangeSelection.Address
With Range(UserCell)

.AddComment
.Comment.Text Text:=CommentVariable
End With
'Color Mismatched Cell in Largest Map
With Selection.Interior
.ColorIndex = 27
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
TotalCompareErrors = TotalCompareErrors + 1
End With
Else
End If ' End IF SheetCellCurrent2 <
SheetCellPrevious2
Next Column


Your thoughts and recommendations.........


Ton

--
ajociu
-----------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...fo&userid=1769
View this thread: http://www.excelforum.com/showthread.php?threadid=39126