简体   繁体   中英

Updating column values on specific Row using VBA

How to update value from xt to xtt in 6th column, first row.

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?

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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