如何将单元格文本转换为整个列的注释?

时间:2017-12-01 16:25:13

标签: excel vba comments

这是单独的,但我需要列中的每个单元格转换为注释。

public class QuitActionTest {

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
        StendhalClient.resetClient();
    }

    /**
     * Tests for execute.
     */
    @Test
    public void testExecute() {
        final QuitAction action = new QuitAction();
        assertThat(action.execute(null, null),is(true));
    }

    /**
     * Tests for getMaximumParameters.
     */
    @Test
    public void testGetMaximumParameters() {
        final QuitAction action = new QuitAction();
        assertThat(action.getMaximumParameters(), is(0));
    }

    /**
     * Tests for getMinimumParameters.
     */
    @Test
    public void testGetMinimumParameters() {
        final QuitAction action = new QuitAction();
        assertThat(action.getMinimumParameters(), is(0));
    }

}

1 个答案:

答案 0 :(得分:0)

这样的事情:

Option Explicit

Sub CelltoComment()

    Dim myCell  As Range

    For Each myCell In Columns(2).SpecialCells(2)

        With myCell
            .Value = ""
            .AddComment
            .Comment.Visible = False
            .Comment.Text myCell.Offset(0, 1).Text
        End With
    Next myCell

End Sub

大部分技巧都是由Offset(0,1)完成的,它取下一列和Columns(2).SpecialCells(2),它只取值。如果你有公式的细胞,他们将被避免。