能够把$K11里的11参数化么?

qhgary 2006-06-26 03:13:58
Range("A11:M11").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(OR($K11=""NotExec"", $K11=""Pass""), TRUE())"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($K11=""Delete"", TRUE())"
Selection.FormatConditions(2).Interior.ColorIndex = 15
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($K11=""Failed"", TRUE())"
Selection.FormatConditions(3).Interior.ColorIndex = 3


我想把里面所有的11变成一个参数形式,这样我可以通过循环来反复执行这一段。
请问如何写这个循环呢?
...全文
137 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ChinaOBS 2006-06-27
  • 打赏
  • 举报
回复
你没有看清楚吧?
qhgary 2006-06-27
  • 打赏
  • 举报
回复
为什么你之前写的代码&在引号里面,现在的&在引号外面呢?
ChinaOBS 2006-06-26
  • 打赏
  • 举报
回复
Range(strSheetName & "!F4, " & strSheetName & "!F7").Select
qhgary 2006-06-26
  • 打赏
  • 举报
回复
A!F4,如果要把A参数化怎么弄?

Range(strSheetName"!F4, "strSheetName"!F7").Select

好像编译不过。
ChinaOBS 2006-06-26
  • 打赏
  • 举报
回复
Sub tes()
Dim i As Integer
i = 11
Range("A" & i & ":M" & i).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(OR($K" & i & "=""NotExec"", $K" & i & "=""Pass""), TRUE())"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($K" & i & "=""Delete"", TRUE())"
Selection.FormatConditions(2).Interior.ColorIndex = 15
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($K" & i & "=""Failed"", TRUE())"
Selection.FormatConditions(3).Interior.ColorIndex = 3
End Sub
thoughter 2006-06-26
  • 打赏
  • 举报
回复
下面的这样行不行
"=IF(OR($K"&列号&"=""NotExec"", $K"&列号&"=""Pass""), TRUE())"
thoughter 2006-06-26
  • 打赏
  • 举报
回复
Range(Cells(11, 1), Cells(11, 13))

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧