Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1590|回复: 6

[已解决]请高手指教一下

[复制链接]
发表于 2010-2-9 13:20 | 显示全部楼层 |阅读模式

删除按钮的代码有错  请高手指教一下

fZtsV6w8.rar (15.54 KB, 下载次数: 0)
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2010-2-9 14:45 | 显示全部楼层

Sheets("数据库").Select

没有数据库这张表

回复

使用道具 举报

 楼主| 发表于 2010-2-9 14:47 | 显示全部楼层
回复

使用道具 举报

发表于 2010-2-9 14:48 | 显示全部楼层

说错了,汗。没认真看,对不起了。我知道了,要把sheets("数据库").visible=true
回复

使用道具 举报

 楼主| 发表于 2010-2-9 14:52 | 显示全部楼层

这样还是无法删除下面的一行东西啊

回复

使用道具 举报

发表于 2010-2-9 14:55 | 显示全部楼层    本楼为最佳答案   

Private Sub CommandButton2_Click()
Dim Xulie As String
    Dim n As Long
    Dim Flag As Boolean   '判断是否找到
    Flag = False
   
    n = 2
    With Sheets("数据库")
         Xulie = Cells(4, 3)
    Do While .Cells(n, 1) <> ""
        If .Cells(n, 1) = Xulie Then
        .Rows(n).Delete Shift:=xlUp
        Range("C4:C17").ClearContents
        Range("C4").Select
        Flag = True
        Exit Do
        End If
        n = n + 1
      Loop
    End With
If Flag = False Then MsgBox "  对不起 没有找到!"
End Sub
[此贴子已经被作者于2010-2-9 14:57:31编辑过]
回复

使用道具 举报

发表于 2010-2-9 14:56 | 显示全部楼层

你写的东西不太规范,帮你改一下,思路还是你的

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-29 05:57 , Processed in 0.226637 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表