|
- Sub 替换数据()
- Dim ws As Worksheet
- Dim lastRow As Long
- Dim i As Long
- Dim cellValue As String
-
- Set ws = ThisWorkbook.Sheets("Sheet1")
-
- lastRow = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
-
- For i = 1 To lastRow
- cellValue = ws.Cells(i, 2).Value
-
- If InStr(1, cellValue, "1#2#", vbTextCompare) > 0 Then
- ws.Cells(i, 3).Value = "公寓"
- ElseIf InStr(1, cellValue, "商铺", vbTextCompare) > 0 Then
- ws.Cells(i, 3).Value = "商铺"
- Else
- ws.Cells(i, 3).Value = "住房"
- End If
- Next i
- ws.AutoFilterMode = False
- ws.Sort.SortFields.Clear
- End Sub
复制代码
满足要求的话,麻烦给个小花花 |
评分
-
1
查看全部评分
-
|