简体   繁体   English

使用VBA更新特定行上的列值

[英]Updating column values on specific Row using VBA

How to update value from xt to xtt in 6th column, first row. 如何在第6列第一行中将值从xt更新为xtt。

1    2    3   4    5  6

x    xx  xy   xz   x1 xt

y    yx  tt   cc  z3  xcc

Based on above data, I am getting range from worksheet. 基于以上数据,我正在从工作表中获取信息。 After getting the Row object, how do I update the Cell value in particular column? 获取Row对象后,如何更新特定列中的Cell值?

As asked, you can update a specific column using the method: 根据要求,您可以使用以下方法更新特定的列:

'Sheet.Cells(row, column) = value
' i.e.
ActiveSheet.Cells(1, 6) = "xtt"

If you only want to perform the update if it has a value of "xt", then obviously you'd need to check the contents before performing the update... For example: 如果仅在值“ xt”的情况下执行更新,那么显然您需要在执行更新之前检查内容...例如:

If (ActiveSheet.Cells(1, 6) = "xt") Then
    ActiveSheet.Cells(1, 6) = "xtt"
End If

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM