Private Sub Form_Click()
    Dim excelApp As Excel.Application
    Set excelApp = New Excel.Application
    On Error Resume Next
    excelApp.Visible = True
    excelApp.Workbooks.Add
    With excelApp.ActiveSheet
        Dim i As Integer, j As Integer
        For i = 1 To 10
            For j = 1 To 10
                 .Cells(i, j).Value = "A"
            Next j
            DoEvents
        Next i
    End With
    ActiveCell.Offset(0, 0).Activate'这句就是你格子的颜色变成黄色
    的坐标,
    Selection.Interior.ColorIndex = 6'这句就是颜色,6 为黄色
    
    Set excelApp = NothingEnd Sub换句话来说你只要在你的源码中加入    ActiveCell.Offset(0, 0).Activate'这句就是你格子的颜色变成黄色
    的坐标(0, 0),
    Selection.Interior.ColorIndex = 6'这句就是颜色,6
    这两句就可以了

解决方案 »

  1.   

    20 分真在太小啦!我要多D!多D!多D!多D!多D!多D!,多谢!
      

  2.   

    最简单的办法是:在excel中录制宏,在vb中粘上宏代码!
      

  3.   

    Private Sub Form_Click()
        Dim excelApp As Excel.Application
        Set excelApp = New Excel.Application
        On Error Resume Next
        excelApp.Visible = True
        excelApp.Workbooks.Add
        With excelApp.ActiveSheet
            Dim i As Integer, j As Integer
            For i = 1 To 10
                For j = 1 To 10
                     .Cells(i, j).Value = "A"
                 Next j
                DoEvents
            Next i
        End With
        excelApp.ActiveSheet.Cells(5, 1).Interior.ColorIndex = 6
             (5,A)变成黄色
        excelApp.ActiveSheet.Cells(6, 3).Interior.ColorIndex = 6
             (6,C)变成黄色
        Set excelApp = NothingEnd Sub_______________________
    Cells(行, 列)  坐标 1 代表A列 2 代表B列 3 代表为……
                        行 用数字代表
    这样你想那行变色者得啦!
      

  4.   

    xiongying860421(文盲)讲的好,录制宏,然后粘贴,Easy.:D