Excel精英培训网

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

[已解决][求助]再请教按位排列的问题

[复制链接]
发表于 2009-9-14 14:02 | 显示全部楼层 |阅读模式

如题,看附件!继续请教!谢谢!

 

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

Private Sub CommandButton1_Click()
    Dim Rng As Range
    Sheet1.Range("D204:Q204").ClearContents
    For Each Rng In Sheet1.Range("EN204:FA204")
        If Val(Rng.Value) > 0 Then
            Sheet1.Cells(204, 3).Offset(0, Rng.Value) = Rng.Value
        End If
    Next
End Sub
[此贴子已经被作者于2009-9-14 14:35:03编辑过]
回复

使用道具 举报

发表于 2009-9-14 14:38 | 显示全部楼层

Private Sub CommandButton1_Click()
    I = 204
    MsgBox Format(2, "00")
    arr1 = Sheets("SHEET1").Range("EN" & I & ":FA" & I)
    For j = 1 To UBound(arr1, 2)
        If arr1(1, j) <> "-" And arr1(1, j) <> "" Then
            Cells(I, arr1(1, j) + 3) = Format(arr1(1, j), "00")
        End If
    Next

       
End Sub

回复

使用道具 举报

 楼主| 发表于 2009-9-14 15:10 | 显示全部楼层

先谢谢老师及版主了,我验证后代码非常棒,只是能不能让数值双位显示,如01&nbsp; 02&nbsp;&nbsp; 03&nbsp;&nbsp; 05等等
回复

使用道具 举报

发表于 2009-9-14 15:11 | 显示全部楼层    本楼为最佳答案   

Private Sub CommandButton1_Click()
Dim Rng As Range
Sheet1.Range("D204:Q204").ClearContents
For Each Rng In Sheet1.Range("EN204:FA204")
If Val(Rng.Value) > 0 Then
Sheet1.Cells(204, 3).Offset(0, Rng.Value) = "'" & Format(Rng.Value,"00")
End If
Next
End Sub
[此贴子已经被作者于2009-9-14 15:11:18编辑过]
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-14 06:49 , Processed in 0.536564 second(s), 6 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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