|
本帖最后由 lindadada 于 2017-6-7 10:26 编辑
- Private Sub CommandButton1_Click()
- Dim i, Rng As Range
- Dim m, n, a As Integer
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- On Error Resume Next
- With ActiveSheet
- m = [A65536].End(xlUp).Row
- n = [IV9].End(xlToLeft).Column
- .Cells(5, 1).Resize(1, n).Clear
- sInt = Application.InputBox(Prompt:="输入账号名")
- If Len(Trim(sInt)) > 0 Then
- AA = sInt
- Else
- MsgBox Prompt:="没有输入有效的账号"
- Exit Sub
- End If
- Set Rng = .Cells(9, 1).Resize(m - 8, n).Find(AA, LookIn:=xlValues, lookat:=1)
- If Not Rng Is Nothing Then
- a = Rng.Row
- Else
- MsgBox Prompt:="您找到你要的信息"
- Exit Sub
- End If
- .Cells(a, 1).Resize(1, n).Copy
- .Cells(5, 1).Resize(1, n).PasteSpecial Paste:=xlPasteValues
- .Cells(3, 1).Resize(1, n).EntireColumn.AutoFit
- With .Range("A3").CurrentRegion.Borders
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- With .Range("A7").CurrentRegion.Borders
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- With .Range("A3").Resize(3, n)
- .VerticalAlignment = xlCenter
- .HorizontalAlignment = xlCenter
- .Font.Name = "微软雅黑"
- .Font.Size = 11
- End With
- With .Range("A7").Resize(m, n)
- .VerticalAlignment = xlCenter
- .HorizontalAlignment = xlCenter
- .Font.Name = "微软雅黑"
- .Font.Size = 11
- End With
- End With
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- End Sub
复制代码
|
|