Excel精英培训网

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

代码修改求教!

[复制链接]
发表于 2012-5-23 17:35 | 显示全部楼层 |阅读模式
各位:下面一段代码红色部分无法录入请帮忙修改一下!
感谢!
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
  Dim i, j, iRow_dn, iRow_dn2
  If Application.WorksheetFunction.CountIf(Range("A2:D10"), "<>") < 36 Then

            MsgBox "数据不能为空,请输入!!!!"
   
       Exit Sub
            End If
  With Sheet3
  iRow_dn = [a19].End(xlUp).Row
  For i = 6 To iRow_dn
   
    iRow_dn2 = .[A65536].End(xlUp).Row
   .Cells(iRow_dn2 + 1, 1) = Cells(1, "b")     'B1单元格内如添加到指定位置(代码如何写)
   .Cells(iRow_dn2 + 1, 2) = Cells(2, "b")  'B2单元格内如添加到指定位置
   .Cells(iRow_dn2 + 1, 3) = Cells(3, "b")    'B3单元格内如添加到指定位置
   .Cells(iRow_dn2 + 1, 4) = Cells(4, "b")    'B4单元格内如添加到指定位置
   .Cells(iRow_dn2 + 1, 5) = Cells(2, "d")   'D2单元格内如添加到指定位置(代码如何写)
   .Cells(iRow_dn2 + 1, 6) = Cells(3, "d")   'D3单元格内如添加到指定位置(代码如何写)

   .Cells(iRow_dn2 + 1, 7) = Cells(4, "d")
     For j = 4 To 9
    .Cells(iRow_dn2 + 1, j) = Cells(i, j - 3)
    Next j
     Next i
      End With
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-5-23 18:53 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2012-5-23 22:48 | 显示全部楼层
那么的帅 发表于 2012-5-23 18:53
提供数据附件

看附件 数据采集.rar (16.42 KB, 下载次数: 2)
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-21 12:00 , Processed in 0.632986 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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