Excel精英培训网

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

第十集作业代码

[复制链接]
发表于 2013-7-16 20:19 | 显示全部楼层 |阅读模式
Sub 替换()
With Worksheets("11集题目")
Dim rg As Range, dyg As Range
Set rg = Selection
For Each dyg In Selection
If Application.WorksheetFunction.IsNumber(dyg) = True And dyg.Value > 0 Then
'If dyg.Value > 0 Then
dyg.Value = "正数"
End If
Next dyg
End With
End Sub
Sub 选择行()
Dim myrange As Range, dyg As Range, zsh As Range, zsh1 As Integer, x As Range, zshx As Integer
Set myrange = Range("a2:c12")
  For Each dyg In myrange
   If Application.WorksheetFunction.IsNumber(dyg) = True And dyg.Value > 0 Then zsh1 = dyg.Row
     Set x = Rows(zsh1)
     Exit For

  Next dyg
  For Each dyg In myrange
    If Application.WorksheetFunction.IsNumber(dyg) = True And dyg.Value > 0 Then zshx = dyg.Row
     Set zsh = Union(x, Rows(zshx))

  Next dyg
zsh.Select
End Sub


excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-22 20:44 , Processed in 0.183882 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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