基于同一行第一列中的任何文本对列进行条件格式设置
我不确定这是否可以在不使用 VB 的情况下实现,但我试图通过条件格式来做到这一点。基本上,如果在该行中输入了记录,我有一列(K 列)将始终具有相同的值(345)。基本上,当我填充报告时,如果该行中有任何数据,我只想将值 (345) 输入到 K 列中。我试图仅使用 A 列作为参考。我搞乱了 =IF(ISTEXT(Col.A location),"345","")
但这毫无进展。所以,我正在寻找 vba 之外的想法,但如果没有可能性,那么我认为 vba 是可行的方法。 :)
I'm not sure if this is even possible without going to VB, but I was trying to do it through conditional formatting. Basically I have a column (Column K) that will always be the same value (345) if there is a record entered in that row. Basically when I populate my reports I simply want the value (345) to be entered into Column K if there is any data in that row. I was trying to just use Column A as a reference. I was messing with =IF(ISTEXT(Col.A location),"345","")
but that's getting nowhere. So, I'm looking for ideas outside of vba, but if there are no possibilities then vba is the way to go I suppose. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
假设您的数据位于 A 至 J 列中,并且从第 2 行开始,请在 K2 中输入此数据并根据需要向下复制:
编辑:对于条件格式公式,您不需要“If”部分,因为格式是已经...条件:
=COUNTA(A2:J2)
Assuming your data is in columns A to J, and that it starts in row 2, enter this in K2 and copy down as necessary:
Edit: For a conditional formatting formula you don't need the "If" part, because the formatting is already ... conditional:
=COUNTA(A2:J2)
这行得通吗?
=IF(ISBLANK(A1),"","345")
Will this work?
=IF(ISBLANK(A1),"","345")
此代码用于判断 A 列中是否有 COUNTA(INDIRECT("$A$"&ROW()))>0,但我认为您不能使用条件设置单元格的值格式化。但是,使用条件格式时,您必须提前知道数据将向下移动多远,除非您只是将其放入所有行中。
为什么不在复制时将其放入 VBA 代码中,您可以找出最后一行是什么,然后将 IF() 公式放入。您可以使用以下代码:
This code works to tell whether column A has something in it or not COUNTA(INDIRECT("$A$"&ROW()))>0, but I don't think you can set the value of the cell using conditional formatting. But with conditional formatting you have to know ahead of time how far down your data is going to go unless you just put it in all the rows.
Why don't you just put it in your VBA code when you are copying, you can find out what the last row is then put the IF() formula in. You can use this code: