|
VB执行之后,标签页自动切换到第一个标签页,加入什么代码,让当前标签页不自动切换到第一个
代码如下:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$5" Then Cells(11, 3) = "请选择"
If Target.Address = "$B$5" Then Cells(7, 3) = "请输入"
If Target.Address = "$B$5" Then Cells(7, 5) = "请输入"
If Target.Address = "$D$80" Then Cells(86, 6) = "请输入根数"
If Target.Address = "$D$80" Then Cells(86, 4) = "请输入直径"
If Target.Address = "$D$80" Then Cells(87, 6) = "请输入根数"
If Target.Address = "$D$80" Then Cells(87, 4) = "请输入直径"
Application.ScreenUpdating = False
If [B5] = "方桩" Or [B5] = "圆桩" Then
Cells(7, 6).HorizontalAlignment = xlRight
Else
Cells(7, 6).HorizontalAlignment = xlDistributed
End If
Cells.EntireRow.Hidden = False
If [M15] = "否" Then
Rows("41:42").Hidden = True
End If
If [F5] = "否" Then
Rows("44:185").Hidden = True
End If
If [F5] = "是" And ([B5] = "方桩" Or [B5] = "圆桩") And [c60] = "试桩" Then
Rows("71:185").Hidden = True
End If
If [F5] = "是" And ([B5] = "方桩" Or [B5] = "圆桩") And [c60] = "工程桩" Then
Rows("77:185").Hidden = True
End If
If [F5] = "是" And [B5] = "方管桩" Then
Rows("59:76").Hidden = True
Rows("93:103").Hidden = True
Rows("117:137").Hidden = True
Rows("150:185").Hidden = True
End If
If [F5] = "是" And [B5] = "圆管桩" Then
Rows("59:76").Hidden = True
Rows("104:116").Hidden = True
Rows("150:185").Hidden = True
End If
If [F5] = "是" And ([B5] = "方管桩" Or [B5] = "圆管桩") And [D80] = "否" Then
Rows("87:88").Hidden = True
Rows("90").Hidden = True
End If
If [L17] = "否" Then
Sheets.Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$149"
Else
Sheets.Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$I$149,$l$16:$S$21"
End If
End Sub
|
|