truongquangtrong
Thành viên mới

- Tham gia
- 6/1/17
- Bài viết
- 37
- Được thích
- 0
Chào các bạn.
Nhờ mọi người xem giúp mình bị lỗi chỗ nào mà nó cứ báo lỗi Runtime hoài... Mò hoài mà không biết nó bị ở đâu.
Nó báo lỗi ở hàng: If (shp.Name Like "*Rectangle*" Or shp.Name Like "*Flowchart*" Or shp.Name Like "*Freeform*") Then
Cảm ơn mọi người.
Xem thêm>>> https://internetvietnam.net/
Nhờ mọi người xem giúp mình bị lỗi chỗ nào mà nó cứ báo lỗi Runtime hoài... Mò hoài mà không biết nó bị ở đâu.
Mã:
Sub CountColorsST() Dim sh As Shape
Dim i As Integer
Dim ws As Worksheet
Dim SS As Worksheet
Set ws = ThisWorkbook.Sheets("Sun-Thu")
Set SS = ThisWorkbook.Sheets("Settings")
ssLastRow = SS.Cells(SS.Rows.Count, "A").End(xlUp).Row - 1
For i = 2 To ssLastRow
SS.Cells(i, 2).Value = 0
Next i
For Each sh In Application.ActiveSheet.Shapes
If (shp.Name Like "*Rectangle*" Or shp.Name Like "*Flowchart*" Or shp.Name Like "*Freeform*") Then
For i = 2 To ssLastRow
If (sh.Fill.ForeColor = SS.Cells(i, 1).Interior.Color) Then
SS.Cells(i, 2).Value = SS.Cells(i, 2).Value + 1
End If
Next i
End If
Next
End Sub
Cảm ơn mọi người.
Xem thêm>>> https://internetvietnam.net/
Lần chỉnh sửa cuối: