|
本帖最后由 ning84 于 2024-11-10 17:48 编辑
必须记住Rows.count的应用。
- Private Sub Tmp()
- Dim Tmp As Worksheet, Sht As Worksheet
- Set Tmp = Sheets("Tmp")
- Set Sht = Sheets("Hotel")
- Dim Shp As Shape
- Dim Shps As Shapes
- Set Shps = Tmp.Shapes
- For ii = Shps.Count To 1 Step -1
- Set Shp = Shps(ii)
- Debug.Print Shp.Name, Shp.Type
- Shp.Delete
- Next ii
- Dim Rr1, Rr2
- Dim oDate As Date
- Dim Rng As Range
- With Sht
-
- Rr2 = .Cells(.Rows.Count, 2).End(xlUp).Row
- Rr1 = .Cells(1, 2).End(xlDown).Row + 1
- 'set rng= .Range ( .Cells (1,2).end(xldown).row,"A"),.Cells (6555556,2).end(xlup).row,"E") )
- Set Rng = .Range(.Cells(Rr1, "B"), .Cells(Rr2, "B"))
- Debug.Print Rng.Address
-
- End With
-
- For ii = 1 To Rng.Rows.Count
- If IsDate(Rng(ii, 1)) Then
- oDate = Rng(ii, 1)
-
- Rng(ii, 1) = "2024/11/" & Format(oDate, "d")
-
- End If
- Next ii
-
-
- End Sub
复制代码 1900/1/1
1900/1/2
1900/1/3
1900/1/4
|
|