Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 激活/停用超链接_Vba_Excel - Fatal编程技术网

Vba 激活/停用超链接

Vba 激活/停用超链接,vba,excel,Vba,Excel,这是我第一次问问题,所以如果我没有提供足够的信息或在其他方面搞砸了,我向所有人道歉 我有一个表,其中的区域在用户需要之前是隐藏的。在创建新工作簿时,通过一个按钮和另一个按钮来调用它们,以再次隐藏它们。每个隐藏区域都在文本框中包含一个超链接(将用户带到工作簿中的其他工作表)(这样,当工作表受到保护时,超链接就可以工作)。我的问题是这些超链接仍然处于活动状态,即使它们被隐藏,光标在这些超链接上也会显示一只手。使用VBA或宏隐藏超链接时,如何停用超链接?欢迎提供任何帮助。谢谢 工作表上的部分由代码隐藏

这是我第一次问问题,所以如果我没有提供足够的信息或在其他方面搞砸了,我向所有人道歉

我有一个表,其中的区域在用户需要之前是隐藏的。在创建新工作簿时,通过一个按钮和另一个按钮来调用它们,以再次隐藏它们。每个隐藏区域都在文本框中包含一个超链接(将用户带到工作簿中的其他工作表)(这样,当工作表受到保护时,超链接就可以工作)。我的问题是这些超链接仍然处于活动状态,即使它们被隐藏,光标在这些超链接上也会显示一只手。使用VBA或宏隐藏超链接时,如何停用超链接?欢迎提供任何帮助。谢谢

工作表上的部分由代码隐藏/显示,该代码将颜色更改为与背景相同的颜色我不想关闭列或行,因为我想保持工作表的标题和大小

所有的编码对我所做的工作都有效,但我花了很长时间试图找到我问题的答案,但没有成功。隐藏部分最多为12个数据输入单元块,根据用户项目要求使用

我在下面放置的代码的一部分用于使块12出现,然后下一个例程用于隐藏除数字1以外的所有块。接下来是一个子例程,用于隐藏块2的文本框。我决定将单元格中的超链接改为文本框,以保护工作表,但仍将超链接用于查看目的。我已经为隐藏文本框的例程添加了代码,我正是用它来禁用超链接的。然而,我能找到的唯一一点代码似乎可以完成这项工作是EnableEvents,但我无法用它实现我想要的,所以我在这里

我相信你可以看到,我是一个程序员,我借用了一些代码,把它们粘在一起,一直玩到它工作为止,但是我已经没有了可以粘的代码和玩的时间

Sub AppearCompOp12()
'
' AppearCompOp12 Macro
'

'
    Range("ar22:bd28").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    With Selection.Font
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
    End With
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = xlAutomatic
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Range("AR22").Select
    Selection.Font.Size = 16
    With Selection.Font
        .Color = -65536
        .TintAndShade = 0
    End With
End Sub

Sub ResetCapMSADashboard()
'
' ResetCapMSADashboard Macro
'

'
    Range( _
        "P6:AB12,AD6:AP12,AR6:BD12,AR14:BD20,AR22:BD28,AD14:AP20,AD22:AP28,P14:AB20,B14:N20,B22:N28,P22:AB28" _
        ).Select
    With Selection.Font
        .Color = RGB(217, 217, 217)
    End With
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = -0.149998474074526
        .PatternTintAndShade = 0
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ThemeColor = 1
        .TintAndShade = -0.14996795556505
        .Weight = xlThin
    End With
    Range("BG2:BG26").Select
    Selection.ClearContents
    Range("J7").Select

End Sub

Sub RecolourTB2()
'
' Change text box & text to background colourbox

'
    ActiveSheet.Shapes.Range(Array("TextBox 9")).Select

    With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorBackground1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = -0.25
        .Transparency = 0
        .Solid
    End With
    Range("P10:W10").Select
    ActiveSheet.Shapes.Range(Array("TextBox 9")).Select
    EnableEvents = False
    With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill

        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorBackground1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = -0.150000006
        .Transparency = 0
        .Solid
    End With
    Range("P9:W9").Select
End Sub

如果我向单元格添加一个超链接,然后隐藏单元格所在的列,我不会看到一只手出现。你说超链接在文本框中?文本框是如何隐藏的?还有,欢迎来到苏。。。习惯上,在这里包括您的第一次编码/公式尝试,以显示您的研究成果,并避免因范围太广而结束。请向我们展示@divindunk:欢迎使用堆栈溢出:请阅读,然后编辑您的问题,确保问a,包括代码、预期行为和错误。。。然后我们可以试着help@divindunk:我投了否决票/投票关闭,因为您没有包括a,看起来像,看起来像是完成了。我编辑了我的问题,希望这次我做对了