Excel精英培训网

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

[已解决]请教在多表中进行查找与引用

[复制链接]
发表于 2011-12-7 16:03 | 显示全部楼层 |阅读模式
请求帮助,我想将1店、2店等的表中的数据,汇总到后面的总表里,因为店数较多,请大家告诉我个简便的方法,谢谢了
最佳答案
2011-12-7 17:25
写了一段代码,看看是不是你所要的。
Sub xrs()
Application.ScreenUpdating = False
Range("C3:J" & [B65536].End(xlUp).Row).ClearContents
Dim Sh As Worksheet
  For Each c In Range("A3:A" & [B65536].End(xlUp).Row)
   If c <> "" Then
     h = c.Value
     x = c.Row
      For Each Sh In Worksheets
        If Sh.Name = h Then
        Cells(x, 3) = Sh.Cells(4, 3)
        Cells(x + 1, 3) = Sh.Cells(5, 3)
        Cells(x, 4) = Sh.Cells(4, 4)
        Cells(x + 1, 4) = Sh.Cells(5, 4)
        Cells(x, 5) = Sh.Cells(4, 5)
        Cells(x + 1, 5) = Sh.Cells(5, 5)
        Cells(x, 6) = Sh.Cells(4, 6)
        Cells(x + 1, 6) = Sh.Cells(5, 6)
        Cells(x, 7) = Sh.Cells(4, 7)
        Cells(x + 1, 7) = Sh.Cells(5, 7)
        Cells(x, 8) = Sh.Cells(8, 1)
        Cells(x, 9) = Sh.Cells(8, 5)
        Cells(x, 10) = Sh.Cells(8, 6)
        End If
      Next
End If
Next c
Application.ScreenUpdating = True
End Sub

2012年.rar

17.17 KB, 下载次数: 8

查找与引用

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2011-12-7 16:23 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2011-12-7 16:33 | 显示全部楼层
我转换成了03的,麻烦帮我看看

2012年.rar

6.15 KB, 下载次数: 14

回复

使用道具 举报

 楼主| 发表于 2011-12-7 16:33 | 显示全部楼层
过江龙 发表于 2011-12-7 16:23
无能为力,俺用滴是2003版的。

我换成03的,麻烦帮我看看吧,谢谢
回复

使用道具 举报

发表于 2011-12-7 17:25 | 显示全部楼层    本楼为最佳答案   
写了一段代码,看看是不是你所要的。
Sub xrs()
Application.ScreenUpdating = False
Range("C3:J" & [B65536].End(xlUp).Row).ClearContents
Dim Sh As Worksheet
  For Each c In Range("A3:A" & [B65536].End(xlUp).Row)
   If c <> "" Then
     h = c.Value
     x = c.Row
      For Each Sh In Worksheets
        If Sh.Name = h Then
        Cells(x, 3) = Sh.Cells(4, 3)
        Cells(x + 1, 3) = Sh.Cells(5, 3)
        Cells(x, 4) = Sh.Cells(4, 4)
        Cells(x + 1, 4) = Sh.Cells(5, 4)
        Cells(x, 5) = Sh.Cells(4, 5)
        Cells(x + 1, 5) = Sh.Cells(5, 5)
        Cells(x, 6) = Sh.Cells(4, 6)
        Cells(x + 1, 6) = Sh.Cells(5, 6)
        Cells(x, 7) = Sh.Cells(4, 7)
        Cells(x + 1, 7) = Sh.Cells(5, 7)
        Cells(x, 8) = Sh.Cells(8, 1)
        Cells(x, 9) = Sh.Cells(8, 5)
        Cells(x, 10) = Sh.Cells(8, 6)
        End If
      Next
End If
Next c
Application.ScreenUpdating = True
End Sub

2012年.rar

13.27 KB, 下载次数: 13

回复

使用道具 举报

 楼主| 发表于 2011-12-9 12:19 | 显示全部楼层
过江龙 发表于 2011-12-7 17:25
写了一段代码,看看是不是你所要的。
Sub xrs()
Application.ScreenUpdating = False

非常感谢,改改后用途非常广
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-21 21:29 , Processed in 0.551974 second(s), 9 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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