Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to create a macro that when a user to select any 2 cells will read in the cell values and comments for each cell. Here is what I have so far. 'read in selected cells Dim sCell As Range Dim sCell1, sCell2 As String Dim sComment1, sComment2 As Comment Dim i As Integer For Each sCell In Selection If i = 0 Then sCell1 = sCell sComment1 = sCell.Comment i = i + 1 Else sCell2 = sCell sComment2 = sCell.Comment End If Next sCell The macro will read in each value but does not like the sComment1 = sCell.Comment. I then tried this. 'read in selected cells Dim sCell As Range Dim sCell1, sCell2 As String Dim sComment1, sComment2 As Comment Dim i As Integer For Each sCell In Selection If i = 0 Then sCell1 = sCell sComment1 = ActiveCell.Comment.Text i = i + 1 Else sCell2 = sCell sComment2 = ActiveCell.Comment.Text End If Next sCell This works for sComment1 but I get a run time error for sComment2. Thanks, Chuck |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
a comment box that only displays when the cell is actually selected | Excel Programming | |||
displaying a comment only when the cell is selected | Excel Discussion (Misc queries) | |||
displaying a comment only when the cell is selected | Excel Discussion (Misc queries) | |||
how read value from last selected cell? It is possible? how get adress last selected cell? | New Users to Excel | |||
how read value from last selected cell? It is possible? how get adress last selected cell? | Excel Programming |