'Bulk Substitution charactersSubTest ()DimI as Integer fori =2 to theIfCells (I,3). Value ="is activated" ThenCells (i,3). Value ="Active"End IfNextEnd Sub
SubTest ()DimRowsnum, I, J, Equalrowsnum as Integer 'declaring VariablesRowsnum = ActiveSheet.UsedRange.Rows.Count'get the number of rows fori =3 toRowsnum'traverse the total number of rowsIfCells (I,1). Value = Cells (i +1,1). Value ThenJ= j +1Else forEqualrowsnum =1 toJ'appends a value to the specified column. Append the same column to the first rowCells (I-j,6). Value =CStr(Cells (I-j,6). Value) +Chr(Ten) +CStr(Cells (i-j + equalrowsnum,6). Value)NextJ=0End IfNextRange ("A3:g20"). RemoveDuplicates1 'empty duplicate rows with a self-function fori =3 toRowsnum'traverse the total number of rows and delete the empty rows. '(This code must be executed several times before the blank line can be deleted)IfCells (I,1) ="" ThenCells (i,1). Entirerow.deleteEnd IfNext'In addition, you can "clear" the empty line in a sorted way:'Sheet1.UsedRange.Sort [A3], xlascending, Header:=xlyes'Note: [A3] represents the column on which to sort'Debug.Print rowsnum ' TestEnd Sub
Vba_ Common VBA code