大佬教程收集整理的这篇文章主要介绍了如何增加行的单元格值,但在列中重复它们?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一段运行良好的代码,但我想按列增加这些值。假设我在 A-E 列中有 60 个单元格,所以我在列 A、B...E 中有 ID_1@H_675_4@ 到
ID_60@H_675_4@。我的代码以
B1@H_675_4@ 的方式运行
ID_61@H_675_4@
有什么建议可以解决吗?
编辑:更改变量名称的代码:
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Dim headername As String
headername = Join(Array("Country","City","X","Y"))
Dim LastusedCell As Range
Set LastusedCell = nothing
Set LastusedCell = wS.UsedRange.Find("*",xlByRows,xlPrevIoUs)
If Not LastusedCell Is nothing Then
Dim headerRow As Range
Set headerRow = ws.Range(ws.Cells(1,1),ws.Cells(1,ws.Cells.columns.Count).End(xlToleft))
Indeks = 0
For Each header In headerRow
If instr(1,headername,header.Value,vbTextComparE) = 0 Then
Dim RangetoAnonimize As Range
Set RangetoAnonimize = ws.Range(ws.Cells(2,header.column),ws.Cells(LastusedCell.Row,header.column))
For Each cell In RangetoAnonimize
cell.Value2 = "ID_" & Indeks
Indeks = Indeks + 1
Next cell
End If
Next header
End If
Next ws
End Sub
@H_675_4@
代码的作用:
然而,目的是一行应该具有相同的 ID。
您的 Indeks = 0@H_675_4@ 应该在
For Each cell@H_675_4@ 之前
Indeks = 0
For Each cell In RangeToAnonimize
@H_675_4@
以上是大佬教程为你收集整理的如何增加行的单元格值,但在列中重复它们?全部内容,希望文章能够帮你解决如何增加行的单元格值,但在列中重复它们?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。