Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
楼主: 兰色幻想

[习题] 【v1-6综合练习题3】批量连接Email地址

[复制链接]
发表于 2007-12-22 15:49 | 显示全部楼层

<p>做来做去,做不对,不知道错在那里,请兄弟们指正</p><p>Sub email()<br/>Dim x%, y%, z%, i%<br/>Dim str As String<br/>y = 1<br/>z = 2<br/>i = 1<br/>str = Cells(2, 1)<br/>For x = 2 To Range("a65536").End(xlUp).Row<br/>&nbsp;&nbsp; If y / 20 = 1 Then<br/>&nbsp;&nbsp;&nbsp; y = 1<br/>&nbsp;&nbsp;&nbsp; z = z + 1<br/>&nbsp;&nbsp;&nbsp; i = i + 21<br/>&nbsp;&nbsp;&nbsp; str = Cells(i, 1)<br/>&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp; str = str &amp; "," &amp; Cells(x, 1)<br/>&nbsp;&nbsp;&nbsp; Cells(z, 3) = str<br/>&nbsp;&nbsp;&nbsp; y = y + 1<br/>&nbsp;&nbsp; End If<br/>Next<br/>End Sub</p>
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
回复

使用道具 举报

发表于 2007-12-22 18:53 | 显示全部楼层

Sub tt3()<br/>燚im AAA As String<br/>燚im i As Integer<br/>燜or i = 2 To Range("a65536").End(xlUp).Row<br/>營f AAA = "" Then<br/>?AAA = Cells(i, 1)<br/>?Else<br/>?AAA = AAA &amp; "," &amp; Cells(i, 1)<br/>?End If<br/>?Next i<br/>?Cells(2, 3) = AAA<br/>?<br/>End Sub<br/>
回复

使用道具 举报

发表于 2007-12-22 18:53 | 显示全部楼层

Sub tt3()<br/>Dim AAA As String<br/>Dim i As Integer<br/>For i = 2 To Range("a65536").End(xlUp).Row<br/>If AAA = "" Then<br/>AAA = Cells(i, 1)<br/>Else<br/>AAA = AAA &amp; "," &amp; Cells(i, 1)<br/>End If<br/>Next i<br/>Cells(2, 3) = AAA<br/>End Sub
回复

使用道具 举报

发表于 2007-12-23 02:53 | 显示全部楼层

[em01]
回复

使用道具 举报

发表于 2007-12-23 16:11 | 显示全部楼层

<br/>Sub 连接()<br/>Dim x, y, z As Integer<br/>Dim email As String<br/>For x = 2 To Range("A65536").End(xlUp).Row Step 20<br/>y = Range("C65536").End(xlUp).Row + 1<br/>&nbsp; For z = 1 To 20<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If email = "" And Cells(x + z - 1, 1).Value &lt;&gt; "" Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email = Cells(x + z - 1, 1).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf email &lt;&gt; "" And Cells(x + z - 1, 1).Value &lt;&gt; "" Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email = email &amp; "," &amp; Cells(x + z - 1, 1).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp; Next z<br/>Cells(y, 3) = email<br/>email = ""<br/>Next x<br/>End Sub
[此贴子已经被作者于2007-12-23 16:15:03编辑过]
回复

使用道具 举报

发表于 2007-12-23 16:18 | 显示全部楼层

<p>Sub tt()<br/>Dim x As Integer, rmg As String<br/>For x = 2 To Range("a65536").End(xlUp).Row<br/>If (x - 2) Mod 20 = 0 Then<br/>rmg = Cells(x, 1)<br/>Else: rmg = rmg &amp; "," &amp; Cells(x, 1)<br/>Cells(Int((x - 2) \ 20) + 2, 3) = rmg<br/>End If<br/>Next x<br/>End Sub</p><p></p><p>做出来了,但是测试速度好象不快..</p>
回复

使用道具 举报

发表于 2007-12-25 04:20 | 显示全部楼层

<div class="msgheader">QUOTE:</div><div class="msgborder"><b>以下是引用<i>minant</i>在2007-12-16 18:16:00的发言:</b><br/><p>占位</p><p>我的也做完了[em01][em01][em01]</p><p>&nbsp;</p><p>Sub exercise3()<br/>Dim i%<br/>&nbsp;&nbsp;&nbsp; With Sheets(1)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For i = 2 To .Cells(65536, 1).End(xlUp).Row<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (i - 2) Mod 20 = 0 Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Cells(.Cells(65536, 3).End(xlUp).Row + 1, 3).Value = .Cells(i, 1).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Cells(.Cells(65536, 3).End(xlUp).Row, 3).Value = _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Cells(.Cells(65536, 3).End(xlUp).Row, 3).Value &amp; "," &amp; .Cells(i, 1).Value<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp; End With<br/>End Sub<br/></p><br/></div><p></p>&nbsp;&nbsp; 沒聽課,只能偷看作業[em04]
回复

使用道具 举报

发表于 2008-1-8 16:21 | 显示全部楼层

练习 提高

[em01]兰老师讲了之后 再下载下来做做
回复

使用道具 举报

发表于 2008-2-4 10:14 | 显示全部楼层

再学习一下。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-29 05:48 , Processed in 0.185732 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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