Excel精英培训网

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

[问题] 求帮助!

[复制链接]
发表于 2012-4-20 10:37 | 显示全部楼层 |阅读模式
Sub 明细账()
MsgBox "提示:未经复核签名的入库数据不能登入明细分类帐!", 64, "学习!"
With Sheets("入库汇总")
X = .[P65536].End(x1up).Row
'确定最后一张经复核签名的入库单第一行所在的行号
For Y = 2 To 4
    If .Cells(X + Y, 1) <> "" And .Cells(X + Y, 16) = "" Then
    Y = Y - 1
    Exit For
     End If
     
     Next Y
R = X + Y
End With
Sheets("入库汇总").protected Password:="******"
Sheets("入库汇总").EnableSelection = x1noselection
With Sheets("修理配件类")
KA = .[A65536].End(x1up).Row + 1
For OB = 3 To R
    Set sh_r = Sheets("入库汇总")
    If sh_r.Cells(OB, 6) = "修理配件类" Then
        If sh_r.Cells(OB, 6).Offset(0, 5) <> "" Then
        
    .Cells(KA, 3) = sh_r.Cells(OB, 6).Offset(0, -5) '编码
    .Cells(KA, 7) = sh_r.Cells(OB, 6).Offset(0, -3) '单位
    .Cells(KA, 5) = sh_r.Cells(OB, 6).Offset(0, -1) '名称
    .Cells(KA, 4) = sh_r.Cells(OB, 6).Offset(0, 3) '单价
    .Cells(KA, 8) = sh_r.Cells(OB, 6).Offset(0, 4) '数量
   
    End If    KA = KA + 1
   End If
   
  Next
  KA = .[A65536].End(x1up).Row
  .Activate
  .Protect Password:="******"
  .EnableSelection = x1unlockedcells
  
  
End With
End Sub

代码在模块一中,运行时黄色部分出错!求高手帮忙检查一下,不胜感激!
学习!.zip (127.4 KB, 下载次数: 7)
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-4-20 10:46 | 显示全部楼层
x1up,你那个当中的是"一"吧,不是"L",改成"L"
回复

使用道具 举报

 楼主| 发表于 2012-4-20 10:50 | 显示全部楼层
hrpotter 发表于 2012-4-20 10:46
x1up,你那个当中的是"一"吧,不是"L",改成"L"


哦,,是了是了   谢谢啦!{:301:}
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-18 10:02 , Processed in 0.183677 second(s), 6 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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