*动态内表alv显示时要求某些单元格显示颜色 *wa_fldcat-datatype不能添加LVC_T_SCOL类型,在创建好内表之后,再添加颜色列. DATA: wa_fldcat TYPE lvc_s_fcat, lt_fldcat TYPE lvc_t_fcat, dy_table TYPE REF TO data, dy_line TYPE REF TO data, <dyn_table> TYPE STANDARD TABLE, <dyn_wa>, dref_tab TY
Private Sub Worksheet_SelectionChange(ByVal Target As Range) '可以直接sub(),不然选择就会触发vba Dim rows_count As Integer Dim rows_id As Integer Dim column_count As Integer Dim column_id As Integer column_count = Selection.Columns.Count '返回选择区域列数
在你要实现此功能的工作表标签右击,在弹出的菜单中选择编辑代码,然后输入下面代码保存即可! 如没有出现效果,则可能是禁用了宏的关系.所以要在安全选项中启用宏选项. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim Rng As Range Set Rng = Target.Range("a1") Cells.Interior.ColorIndex = 0 '清除所有背景色 Rng.EntireColumn.I
Public Function QTP_Change_Color(pathway,sheetname,x,y,color) Dim srcData,srcDoc,sp1,sp2,num,use,a1,a2,a3 set srcData = CreateObject("Excel.Application") srcData.Visible = True set srcDoc = srcData.Workbooks.Open(path
你想这样啊,试试这段代码看行不:右键工作表名称--查看代码,在空白处粘贴就可以 Private Sub Worksheet_SelectionChange(ByVal Target As Range) Cells.Interior.ColorIndex = xlNone Target.Interior.ColorIndex = 8 End Sub 复制代码