可以做一个按钮公式(0-9列的列名称更改为:00-09)如下:
EvalFor(GridName,"00","If(Instr(""0"",[数据])>-1,""0"","""")") And EvalFor(GridName,"p","Cell(Row,""00"")=""0"" And Cell(Row-1,""00"")=""0"" And Cell(Row-2,""00"")=""0"" Or Cell(Row,""00"")=""0"" And Cell(Row-1,""00"")=""0"" And Cell(Row+1,""00"")=""0"" Or Cell(Row,""00"")=""0"" And Cell(Row+1,""00"")=""0"" And Cell(Row+2,""00"")=""0""") And MarkColFor("00",255,0,"p","=",-1) And EvalFor(GridName,"01","If(Instr(""1"",[数据])>-1,""1"","""")") And EvalFor(GridName,"p","Cell(Row,""01"")=""1"" And Cell(Row-1,""01"")=""1"" And Cell(Row-2,""01"")=""1"" Or Cell(Row,""01"")=""1"" And Cell(Row-1,""01"")=""1"" And Cell(Row+1,""01"")=""1"" Or Cell(Row,""01"")=""1"" And Cell(Row+1,""01"")=""1"" And Cell(Row+2,""01"")=""1""") And MarkColFor("01",255,0,"p","=",-1) And EvalFor(GridName,"02","If(Instr(""2"",[数据])>-1,""2"","""")") And EvalFor(GridName,"p","Cell(Row,""02"")=""2"" And Cell(Row-1,""02"")=""2"" And Cell(Row-2,""02"")=""2"" Or Cell(Row,""02"")=""2"" And Cell(Row-1,""02"")=""2"" And Cell(Row+1,""02"")=""2"" Or Cell(Row,""02"")=""2"" And Cell(Row+1,""02"")=""2"" And Cell(Row+2,""02"")=""2""") And MarkColFor("02",255,0,"p","=",-1) And EvalFor(GridName,"03","If(Instr(""3"",[数据])>-1,""3"","""")") And EvalFor(GridName,"p","Cell(Row,""03"")=""3"" And Cell(Row-1,""03"")=""3"" And Cell(Row-2,""03"")=""3"" Or Cell(Row,""03"")=""3"" And Cell(Row-1,""03"")=""3"" And Cell(Row+1,""03"")=""3"" Or Cell(Row,""03"")=""3"" And Cell(Row+1,""03"")=""3"" And Cell(Row+2,""03"")=""3""") And MarkColFor("03",255,0,"p","=",-1) And EvalFor(GridName,"04","If(Instr(""4"",[数据])>-1,""4"","""")") And EvalFor(GridName,"p","Cell(Row,""04"")=""4"" And Cell(Row-1,""04"")=""4"" And Cell(Row-2,""04"")=""4"" Or Cell(Row,""04"")=""4"" And Cell(Row-1,""04"")=""4"" And Cell(Row+1,""04"")=""4"" Or Cell(Row,""04"")=""4"" And Cell(Row+1,""04"")=""4"" And Cell(Row+2,""04"")=""4""") And MarkColFor("04",255,0,"p","=",-1) And EvalFor(GridName,"05","If(Instr(""5"",[数据])>-1,""5"","""")") And EvalFor(GridName,"p","Cell(Row,""05"")=""5"" And Cell(Row-1,""05"")=""5"" And Cell(Row-2,""05"")=""5"" Or Cell(Row,""05"")=""5"" And Cell(Row-1,""05"")=""5"" And Cell(Row+1,""05"")=""5"" Or Cell(Row,""05"")=""5"" And Cell(Row+1,""05"")=""5"" And Cell(Row+2,""05"")=""5""") And MarkColFor("05",255,0,"p","=",-1) And EvalFor(GridName,"06","If(Instr(""6"",[数据])>-1,""6"","""")") And EvalFor(GridName,"p","Cell(Row,""06"")=""6"" And Cell(Row-1,""06"")=""6"" And Cell(Row-2,""06"")=""6"" Or Cell(Row,""06"")=""6"" And Cell(Row-1,""06"")=""6"" And Cell(Row+1,""06"")=""6"" Or Cell(Row,""06"")=""6"" And Cell(Row+1,""06"")=""6"" And Cell(Row+2,""06"")=""6""") And MarkColFor("06",255,0,"p","=",-1) And EvalFor(GridName,"07","If(Instr(""7"",[数据])>-1,""7"","""")") And EvalFor(GridName,"p","Cell(Row,""07"")=""7"" And Cell(Row-1,""07"")=""7"" And Cell(Row-2,""07"")=""7"" Or Cell(Row,""07"")=""7"" And Cell(Row-1,""07"")=""7"" And Cell(Row+1,""07"")=""7"" Or Cell(Row,""07"")=""7"" And Cell(Row+1,""07"")=""7"" And Cell(Row+2,""07"")=""7""") And MarkColFor("07",255,0,"p","=",-1) And EvalFor(GridName,"08","If(Instr(""8"",[数据])>-1,""8"","""")") And EvalFor(GridName,"p","Cell(Row,""08"")=""8"" And Cell(Row-1,""08"")=""8"" And Cell(Row-2,""08"")=""8"" Or Cell(Row,""08"")=""8"" And Cell(Row-1,""08"")=""8"" And Cell(Row+1,""08"")=""8"" Or Cell(Row,""08"")=""8"" And Cell(Row+1,""08"")=""8"" And Cell(Row+2,""08"")=""8""") And MarkColFor("08",255,0,"p","=",-1) And EvalFor(GridName,"09","If(Instr(""9"",[数据])>-1,""9"","""")") And EvalFor(GridName,"p","Cell(Row,""09"")=""9"" And Cell(Row-1,""09"")=""9"" And Cell(Row-2,""09"")=""9"" Or Cell(Row,""09"")=""9"" And Cell(Row-1,""09"")=""9"" And Cell(Row+1,""09"")=""9"" Or Cell(Row,""09"")=""9"" And Cell(Row+1,""09"")=""9"" And Cell(Row+2,""09"")=""9""") And MarkColFor("09",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""00"")=""0"" And Cell(Row+1,""01"")=""1"" And Cell(Row+2,""02"")=""2""") And MarkColFor("00",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""01"")=""1"" And Cell(Row-1,""00"")=""0"" And Cell(Row+1,""02"")=""2"" Or Cell(Row,""01"")=""1"" And Cell(Row+1,""02"")=""2"" And Cell(Row+2,""03"")=""3""") And MarkColFor("01",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""02"")=""2"" And Cell(Row-1,""01"")=""1"" And Cell(Row+1,""03"")=""3"" Or Cell(Row,""02"")=""2"" And Cell(Row+1,""03"")=""3"" And Cell(Row+2,""04"")=""4"" Or Cell(Row,""02"")=""2"" And Cell(Row-1,""01"")=""1"" And Cell(Row-2,""00"")=""0""") And MarkColFor("02",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""03"")=""3"" And Cell(Row-1,""02"")=""2"" And Cell(Row+1,""04"")=""4"" Or Cell(Row,""03"")=""3"" And Cell(Row+1,""04"")=""4"" And Cell(Row+2,""05"")=""5"" Or Cell(Row,""03"")=""3"" And Cell(Row-1,""02"")=""2"" And Cell(Row-2,""01"")=""1""") And MarkColFor("03",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""04"")=""4"" And Cell(Row-1,""03"")=""3"" And Cell(Row+1,""05"")=""5"" Or Cell(Row,""04"")=""4"" And Cell(Row+1,""05"")=""5"" And Cell(Row+2,""06"")=""6"" Or Cell(Row,""04"")=""4"" And Cell(Row-1,""03"")=""3"" And Cell(Row-2,""02"")=""2""") And MarkColFor("04",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""05"")=""5"" And Cell(Row-1,""04"")=""4"" And Cell(Row+1,""06"")=""6"" Or Cell(Row,""05"")=""5"" And Cell(Row+1,""06"")=""6"" And Cell(Row+2,""07"")=""7"" Or Cell(Row,""05"")=""5"" And Cell(Row-1,""04"")=""4"" And Cell(Row-2,""03"")=""3""") And MarkColFor("05",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""06"")=""6"" And Cell(Row-1,""05"")=""5"" And Cell(Row+1,""07"")=""7"" Or Cell(Row,""06"")=""6"" And Cell(Row+1,""07"")=""7"" And Cell(Row+2,""08"")=""8"" Or Cell(Row,""06"")=""6"" And Cell(Row-1,""05"")=""5"" And Cell(Row-2,""04"")=""4""") And MarkColFor("06",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""07"")=""7"" And Cell(Row-1,""06"")=""6"" And Cell(Row+1,""08"")=""8"" Or Cell(Row,""07"")=""7"" And Cell(Row+1,""08"")=""8"" And Cell(Row+2,""09"")=""9"" Or Cell(Row,""07"")=""7"" And Cell(Row-1,""06"")=""6"" And Cell(Row-2,""05"")=""5""") And MarkColFor("07",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""08"")=""8"" And Cell(Row-1,""07"")=""7"" And Cell(Row+1,""09"")=""9"" Or Cell(Row,""08"")=""8"" And Cell(Row-1,""07"")=""7"" And Cell(Row-2,""06"")=""6""") And MarkColFor("08",255,0,"p","=",-1) And EvalFor(GridName,"p","Cell(Row,""09"")=""9"" And Cell(Row-1,""08"")=""8"" And Cell(Row-2,""07"")=""7""") And MarkColFor("09",255,0,"p","=",-1)