Giúp tối ưu hóa thời gian lấy dữ liệu (1 người xem)

Liên hệ QC

Người dùng đang xem chủ đề này

LGDMinhNC

Thành viên mới
Tham gia
13/4/20
Bài viết
16
Được thích
1
Giới tính
Nam
Dear All,

Hiện em đang có 1 file report (File chính thì ở công ty không lấy ra được, em làm demo 1 file khác).
Em muốn tối ưu thời gian report vì data/month của em rất lớn, và các sếp muốn theo dõi cho nhiều tháng nên report rất lâu.
1 sheet có nhiều vùng cần count, em muốn mỗi lần report thì chỉ cần for 1 lần thôi. Bác nào có idea hay cách nào khác cho vấn đề này không ạ.
Chi tiết các bác xem file đính kèm giúp em nhé.
Tks.

Sub Report:
Mã:
Sub Report()
t = Timer
Dim Model As String
Dim Source As String
Dim Line As String
Dim Unit As String
Dim Shift As String
Dim ReportType As String
Dim SheetReport As Worksheet
Dim SheetRawdata As Worksheet
Dim ArrRawdata As Variant
Dim ArrDate As Variant
Dim ArrDefectName As Variant
Dim Res As Variant

Set SheetReport = ThisWorkbook.Sheets("Report")
Set SheetRawdata = ThisWorkbook.Sheets("Rawdata")

ArrRawdata = SheetRawdata.Range("B6:L" & SheetRawdata.Range("C1048576").End(3).Row)
ArrDate = SheetReport.Range("C11:T11")
ArrDefectName = SheetReport.Range("B12:B" & SheetReport.Range("B1048576").End(3).Row)

Model = SheetReport.[C2].Value2
Source = SheetReport.[C3].Value2
Line = SheetReport.[C4].Value2
Unit = SheetReport.[C5].Value2
Shift = SheetReport.[C6].Value2

'--> Sampling
ReportType = SheetReport.[B10].Value2
Res = Get_Data(ArrRawdata, ArrDate, ArrDefectName, ReportType, 8, Model, 3, Source, 4, Line, 5, Unit, 6, Shift, 7)
SheetReport.[C12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res


'--> 100%
ReportType = SheetReport.[V10].Value2
Res = Get_Data(ArrRawdata, ArrDate, ArrDefectName, ReportType, 8, Model, 3, Source, 4, Line, 5, Unit, 6, Shift, 7)
SheetReport.[W12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res

MsgBox "Summary Finshed: " & Format(Timer - t, "0.00"), , "MinhNC - Information"

End Sub


Function Get_Data:
Mã:
Function Get_Data(ArrRawdata As Variant, ArrDate As Variant, ArrDefect As Variant, ReportType As String, ColReportType As Long, _
                  Model As String, ColModel As Long, Source As String, ColSource As Long, Line As String, ColLine As Long, _
                  Unit As String, ColUnit As Long, Shift As String, ColShift As Long)


Dim i As Long, j As Long, k As Long
Dim Res As Variant
Dim Dic As Object
Dim dItem As Long
Dim Pos As Long
ReDim Res(1 To UBound(ArrDefect, 1), 1 To UBound(ArrDate, 2))

Set Dic = CreateObject("Scripting.Dictionary")

For i = 1 To UBound(ArrDefect, 1)
    If ArrDefect(i, 1) <> "" Then
        If Not Dic.exists(ArrDefect(i, 1)) Then
            dItem = dItem + 1
            Dic.Add ArrDefect(i, 1), dItem
        End If
    End If
Next

For j = 1 To UBound(ArrDate, 2)
    For i = 1 To UBound(ArrRawdata, 1)
        If ArrRawdata(i, 2) <> "" And Month(ArrRawdata(i, 2)) & "M" = ArrDate(1, j) Or _
           Application.WorksheetFunction.WeekNum(ArrRawdata(i, 2)) & "W" = ArrDate(1, j) Or _
           ArrRawdata(i, 2) = ArrDate(1, j) Then
            If ArrRawdata(i, ColReportType) Like ReportType Then
                If ArrRawdata(i, ColModel) Like Model Then
                    If ArrRawdata(i, ColSource) Like Source Then
                        If ArrRawdata(i, ColLine) Like Line Then
                            If ArrRawdata(i, ColUnit) Like Unit Then
                                If ArrRawdata(i, ColShift) Like Shift Then
                                    For k = 10 To 11
                                        If ArrRawdata(i, k) <> "" Then
                                            Pos = Dic.Item(ArrRawdata(i, k))
                                            Res(Pos, j) = Res(Pos, j) + 1
                                        End If
                                    Next
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    Next
Next

Get_Data = Res

End Function


Img - Excel:
1586745754223.png
 

File đính kèm

Dear All,

Hiện em đang có 1 file report (File chính thì ở công ty không lấy ra được, em làm demo 1 file khác).
Em muốn tối ưu thời gian report vì data/month của em rất lớn, và các sếp muốn theo dõi cho nhiều tháng nên report rất lâu.
1 sheet có nhiều vùng cần count, em muốn mỗi lần report thì chỉ cần for 1 lần thôi. Bác nào có idea hay cách nào khác cho vấn đề này không ạ.
Chi tiết các bác xem file đính kèm giúp em nhé.
Tks.

Sub Report:
Mã:
Sub Report()
t = Timer
Dim Model As String
Dim Source As String
Dim Line As String
Dim Unit As String
Dim Shift As String
Dim ReportType As String
Dim SheetReport As Worksheet
Dim SheetRawdata As Worksheet
Dim ArrRawdata As Variant
Dim ArrDate As Variant
Dim ArrDefectName As Variant
Dim Res As Variant

Set SheetReport = ThisWorkbook.Sheets("Report")
Set SheetRawdata = ThisWorkbook.Sheets("Rawdata")

ArrRawdata = SheetRawdata.Range("B6:L" & SheetRawdata.Range("C1048576").End(3).Row)
ArrDate = SheetReport.Range("C11:T11")
ArrDefectName = SheetReport.Range("B12:B" & SheetReport.Range("B1048576").End(3).Row)

Model = SheetReport.[C2].Value2
Source = SheetReport.[C3].Value2
Line = SheetReport.[C4].Value2
Unit = SheetReport.[C5].Value2
Shift = SheetReport.[C6].Value2

'--> Sampling
ReportType = SheetReport.[B10].Value2
Res = Get_Data(ArrRawdata, ArrDate, ArrDefectName, ReportType, 8, Model, 3, Source, 4, Line, 5, Unit, 6, Shift, 7)
SheetReport.[C12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res


'--> 100%
ReportType = SheetReport.[V10].Value2
Res = Get_Data(ArrRawdata, ArrDate, ArrDefectName, ReportType, 8, Model, 3, Source, 4, Line, 5, Unit, 6, Shift, 7)
SheetReport.[W12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res

MsgBox "Summary Finshed: " & Format(Timer - t, "0.00"), , "MinhNC - Information"

End Sub


Function Get_Data:
Mã:
Function Get_Data(ArrRawdata As Variant, ArrDate As Variant, ArrDefect As Variant, ReportType As String, ColReportType As Long, _
                  Model As String, ColModel As Long, Source As String, ColSource As Long, Line As String, ColLine As Long, _
                  Unit As String, ColUnit As Long, Shift As String, ColShift As Long)


Dim i As Long, j As Long, k As Long
Dim Res As Variant
Dim Dic As Object
Dim dItem As Long
Dim Pos As Long
ReDim Res(1 To UBound(ArrDefect, 1), 1 To UBound(ArrDate, 2))

Set Dic = CreateObject("Scripting.Dictionary")

For i = 1 To UBound(ArrDefect, 1)
    If ArrDefect(i, 1) <> "" Then
        If Not Dic.exists(ArrDefect(i, 1)) Then
            dItem = dItem + 1
            Dic.Add ArrDefect(i, 1), dItem
        End If
    End If
Next

For j = 1 To UBound(ArrDate, 2)
    For i = 1 To UBound(ArrRawdata, 1)
        If ArrRawdata(i, 2) <> "" And Month(ArrRawdata(i, 2)) & "M" = ArrDate(1, j) Or _
           Application.WorksheetFunction.WeekNum(ArrRawdata(i, 2)) & "W" = ArrDate(1, j) Or _
           ArrRawdata(i, 2) = ArrDate(1, j) Then
            If ArrRawdata(i, ColReportType) Like ReportType Then
                If ArrRawdata(i, ColModel) Like Model Then
                    If ArrRawdata(i, ColSource) Like Source Then
                        If ArrRawdata(i, ColLine) Like Line Then
                            If ArrRawdata(i, ColUnit) Like Unit Then
                                If ArrRawdata(i, ColShift) Like Shift Then
                                    For k = 10 To 11
                                        If ArrRawdata(i, k) <> "" Then
                                            Pos = Dic.Item(ArrRawdata(i, k))
                                            Res(Pos, j) = Res(Pos, j) + 1
                                        End If
                                    Next
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    Next
Next

Get_Data = Res

End Function


Img - Excel:
View attachment 235454
Không nên dùng các từ không phải tiếng Việt thuần túy
Chép code vào 1 module, chạy code Report
Mã:
Sub Report()
  t = Timer
  Dim Model$, Source$, Line$, Unit$, Shift$, ReportType$
  Dim ArrRawdata(), ArrDate(), ArrDefect(), aCol(), Res(), Res2()
  Dim Dic As Object

  With Sheets("Rawdata")
    ArrRawdata = .Range("B6:L" & .Range("C1048576").End(3).Row).Value
  End With
  With Sheets("Report")
    ArrDate = .Range("C11:T11").Value
    ArrDefect = .Range("B12", .Range("B1048576").End(3)).Value
    Call Create_Dic(Dic, ArrDefect, ArrDate)
   
    Model = .[C2].Value2:         Source = .[C3].Value2
    Line = .[C4].Value2:          Unit = .[C5].Value2
    Shift = .[C6].Value2
    aCol = Array("", "", "", Model, Source, Line, Unit, Shift)
    ReportType = .[B10].Value2 '--> Sampling
    ReportType2 = .[V10].Value2 '--> 100%
   
    Call Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
    .[C12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res
    .[W12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res2
  End With
  MsgBox "Summary Finshed: " & Format(Timer - t, "0.00"), , "MinhNC - Information"
End Sub

Private Sub Create_Dic(ByRef Dic, ByRef ArrDefect, ByRef ArrDate)
  Dim i&, iKey
  Set Dic = CreateObject("Scripting.Dictionary")
  For i = 1 To UBound(ArrDefect, 1)
    iKey = ArrDefect(i, 1)
    If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, i
        End If
      End If
    Next
    For j = 1 To UBound(ArrDate, 2)
      iKey = ArrDate(1, j)
      If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, j
        End If
      End If
    Next
End Sub

Private Sub Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
  Dim sRow, Scol&, i&, j&, c&, ik&, jC&, jC2&, jC3&
  Dim bTest As Boolean

  sRow = UBound(ArrRawdata, 1)
  Scol = UBound(ArrDate, 2)
  ReDim Res(1 To sRow, 1 To Scol)
  ReDim Res2(1 To sRow, 1 To Scol)
  For i = 1 To sRow
    jC3 = Dic.Item(ArrRawdata(i, 2))
    If jC3 > 0 Then
      bTest = True
      For j = 3 To UBound(aCol)
        If Not ArrRawdata(i, j) Like aCol(j) Then
          bTest = False: Exit For
        End If
      Next j
      If bTest Then
      jC = Dic.Item(Month(ArrRawdata(i, 2)) & "M")
      jC2 = Dic.Item(Application.WeekNum(ArrRawdata(i, 2)) & "W")
        For c = 10 To 11
          ik = Dic.Item(ArrRawdata(i, c))
          If ik > 0 Then
            If ArrRawdata(i, 8) = ReportType Then
              Res(ik, jC3) = Res(ik, jC3) + 1
              If jC > 0 Then Res(ik, jC) = Res(ik, jC) + 1
              If jC2 > 0 Then Res(ik, jC2) = Res(ik, jC2) + 1
            ElseIf ArrRawdata(i, 8) = ReportType2 Then
              Res2(ik, jC3) = Res2(ik, jC3) + 1
              If jC > 0 Then Res2(ik, jC) = Res2(ik, jC) + 1
              If jC2 > 0 Then Res2(ik, jC2) = Res2(ik, jC2) + 1
            End If
          End If
        Next c
      End If
    End If
  Next i
End Sub
 
Lần chỉnh sửa cuối:
Upvote 0
Không nên dùng các từ không phải tiếng Việt thuần túy
Chép code vào 1 module, chạy code Report
Mã:
Sub Report()
  t = Timer
  Dim Model$, Source$, Line$, Unit$, Shift$, ReportType$
  Dim ArrRawdata(), ArrDate(), ArrDefect(), aCol(), Res(), Res2()
  Dim Dic As Object

  With Sheets("Rawdata")
    ArrRawdata = .Range("B6:L" & .Range("C1048576").End(3).Row).Value
  End With
  With Sheets("Report")
    ArrDate = .Range("C11:T11").Value
    ArrDefect = .Range("B12", .Range("B1048576").End(3)).Value
    Call Create_Dic(Dic, ArrDefect, ArrDate)
  
    Model = .[C2].Value2:         Source = .[C3].Value2
    Line = .[C4].Value2:          Unit = .[C5].Value2
    Shift = .[C6].Value2
    aCol = Array("", "", "", Model, Source, Line, Unit, Shift)
    ReportType = .[B10].Value2 '--> Sampling
    ReportType2 = .[V10].Value2 '--> 100%
  
    Call Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
    .[C12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res
    .[W12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res2
  End With
  MsgBox "Summary Finshed: " & Format(Timer - t, "0.00"), , "MinhNC - Information"
End Sub

Private Sub Create_Dic(ByRef Dic, ByRef ArrDefect, ByRef ArrDate)
  Dim i&, iKey
  Set Dic = CreateObject("Scripting.Dictionary")
  For i = 1 To UBound(ArrDefect, 1)
    iKey = ArrDefect(i, 1)
    If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, i
        End If
      End If
    Next
    For j = 1 To UBound(ArrDate, 2)
      iKey = ArrDate(1, j)
      If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, j
        End If
      End If
    Next
End Sub

Private Sub Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
  Dim sRow, Scol&, i&, j&, c&, ik&, jC&, jC2&, jC3&
  Dim bTest As Boolean

  sRow = UBound(ArrRawdata, 1)
  Scol = UBound(ArrDate, 2)
  ReDim Res(1 To sRow, 1 To Scol)
  ReDim Res2(1 To sRow, 1 To Scol)
  For i = 1 To sRow
    jC3 = Dic.Item(ArrRawdata(i, 2))
    If jC3 > 0 Then
      bTest = True
      For j = 3 To UBound(aCol)
        If Not ArrRawdata(i, j) Like aCol(j) Then
          bTest = False: Exit For
        End If
      Next j
      If bTest Then
      jC = Dic.Item(Month(ArrRawdata(i, 2)) & "M")
      jC2 = Dic.Item(Application.WeekNum(ArrRawdata(i, 2)) & "W")
        For c = 10 To 11
          ik = Dic.Item(ArrRawdata(i, c))
          If ik > 0 Then
            If ArrRawdata(i, 8) = ReportType Then
              Res(ik, jC3) = Res(ik, jC3) + 1
              If jC > 0 Then Res(ik, jC) = Res(ik, jC) + 1
              If jC2 > 0 Then Res(ik, jC2) = Res(ik, jC2) + 1
            ElseIf ArrRawdata(i, 8) = ReportType2 Then
              Res2(ik, jC3) = Res2(ik, jC3) + 1
              If jC > 0 Then Res2(ik, jC) = Res2(ik, jC) + 1
              If jC2 > 0 Then Res2(ik, jC2) = Res2(ik, jC2) + 1
            End If
          End If
        Next c
      End If
    End If
  Next i
End Sub


1. Tks bác. để em thử.
2. "Không nên dùng các từ không phải tiếng Việt thuần túy" ---> Ý bác nói trong code hay bên ngoài ấy
Bài đã được tự động gộp:

Không nên dùng các từ không phải tiếng Việt thuần túy
Chép code vào 1 module, chạy code Report
Mã:
Sub Report()
  t = Timer
  Dim Model$, Source$, Line$, Unit$, Shift$, ReportType$
  Dim ArrRawdata(), ArrDate(), ArrDefect(), aCol(), Res(), Res2()
  Dim Dic As Object

  With Sheets("Rawdata")
    ArrRawdata = .Range("B6:L" & .Range("C1048576").End(3).Row).Value
  End With
  With Sheets("Report")
    ArrDate = .Range("C11:T11").Value
    ArrDefect = .Range("B12", .Range("B1048576").End(3)).Value
    Call Create_Dic(Dic, ArrDefect, ArrDate)
  
    Model = .[C2].Value2:         Source = .[C3].Value2
    Line = .[C4].Value2:          Unit = .[C5].Value2
    Shift = .[C6].Value2
    aCol = Array("", "", "", Model, Source, Line, Unit, Shift)
    ReportType = .[B10].Value2 '--> Sampling
    ReportType2 = .[V10].Value2 '--> 100%
  
    Call Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
    .[C12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res
    .[W12].Resize(UBound(Res, 1), UBound(Res, 2)) = Res2
  End With
  MsgBox "Summary Finshed: " & Format(Timer - t, "0.00"), , "MinhNC - Information"
End Sub

Private Sub Create_Dic(ByRef Dic, ByRef ArrDefect, ByRef ArrDate)
  Dim i&, iKey
  Set Dic = CreateObject("Scripting.Dictionary")
  For i = 1 To UBound(ArrDefect, 1)
    iKey = ArrDefect(i, 1)
    If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, i
        End If
      End If
    Next
    For j = 1 To UBound(ArrDate, 2)
      iKey = ArrDate(1, j)
      If iKey <> "" Then
        If Not Dic.exists(iKey) Then
            Dic.Add iKey, j
        End If
      End If
    Next
End Sub

Private Sub Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
  Dim sRow, Scol&, i&, j&, c&, ik&, jC&, jC2&, jC3&
  Dim bTest As Boolean

  sRow = UBound(ArrRawdata, 1)
  Scol = UBound(ArrDate, 2)
  ReDim Res(1 To sRow, 1 To Scol)
  ReDim Res2(1 To sRow, 1 To Scol)
  For i = 1 To sRow
    jC3 = Dic.Item(ArrRawdata(i, 2))
    If jC3 > 0 Then
      bTest = True
      For j = 3 To UBound(aCol)
        If Not ArrRawdata(i, j) Like aCol(j) Then
          bTest = False: Exit For
        End If
      Next j
      If bTest Then
      jC = Dic.Item(Month(ArrRawdata(i, 2)) & "M")
      jC2 = Dic.Item(Application.WeekNum(ArrRawdata(i, 2)) & "W")
        For c = 10 To 11
          ik = Dic.Item(ArrRawdata(i, c))
          If ik > 0 Then
            If ArrRawdata(i, 8) = ReportType Then
              Res(ik, jC3) = Res(ik, jC3) + 1
              If jC > 0 Then Res(ik, jC) = Res(ik, jC) + 1
              If jC2 > 0 Then Res(ik, jC2) = Res(ik, jC2) + 1
            ElseIf ArrRawdata(i, 8) = ReportType2 Then
              Res2(ik, jC3) = Res2(ik, jC3) + 1
              If jC > 0 Then Res2(ik, jC) = Res2(ik, jC) + 1
              If jC2 > 0 Then Res2(ik, jC2) = Res2(ik, jC2) + 1
            End If
          End If
        Next c
      End If
    End If
  Next i
End Sub



Cho mình hỏi là kí tự: "$" và "&" trong dim mang ý nghĩa như thế nào vậy bác
 
Lần chỉnh sửa cuối:
Upvote 0
1. Tks bác. để em thử.
2. "Không nên dùng các từ không phải tiếng Việt thuần túy" ---> Ý bác nói trong code hay bên ngoài ấy
Bài đã được tự động gộp:





Cho mình hỏi là kí tự: "$" và "&" trong dim mang ý nghĩa như thế nào vậy bác
Không nên dùng các từ "Dear All", "Ths" , bạn đọc nội qui diễn đàn sẽ rỏ
Dim tmp$, i&
Là thay thế cho
Dim tmp as string, i as long
Nhằm rút gọn khai báo
Code chỉ tính tháng và tuần chỉ khi trùng ngày, không trùng ngày không tính
 
Upvote 0
Không nên dùng các từ "Dear All", "Ths" , bạn đọc nội qui diễn đàn sẽ rỏ
Dim tmp$, i&
Là thay thế cho
Dim tmp as string, i as long
Nhằm rút gọn khai báo
Code chỉ tính tháng và tuần chỉ khi trùng ngày, không trùng ngày không tính


Cảm ơn bạn,
Đêm qua mình đi làm sửa file ở công ty tốc độ cải thiện ~15 lần. 70s > 5s. Phê
 
Upvote 0
Cảm ơn bạn,
Đêm qua mình đi làm sửa file ở công ty tốc độ cải thiện ~15 lần. 70s > 5s. Phê
Nếu thỏa điều kiện tháng và tuần thì đếm cột tương ứng, chỉnh Private Sub Get_Res
Mã:
Private Sub Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
  Dim sRow, Scol&, i&, j&, c&, ik&, jC&, jC2&, jC3&, iDate

  sRow = UBound(ArrRawdata, 1)
  Scol = UBound(ArrDate, 2)
  ReDim Res(1 To sRow, 1 To Scol)
  ReDim Res2(1 To sRow, 1 To Scol)
  For i = 1 To sRow
    iDate = ArrRawdata(i, 2)
    jC = Dic.Item(Month(iDate) & "M")
    If jC > 0 Then
      For j = 3 To UBound(aCol)
        If Not ArrRawdata(i, j) Like aCol(j) Then Exit For
      Next j
      If j > UBound(aCol) Then
        jC2 = Dic.Item(Application.WeekNum(iDate) & "W")
        jC3 = Dic.Item(iDate)
        For c = 10 To 11
          ik = Dic.Item(ArrRawdata(i, c))
          If ik > 0 Then
            If ArrRawdata(i, 8) = ReportType Then
              Res(ik, jC) = Res(ik, jC) + 1
              If jC2 > 0 Then Res(ik, jC2) = Res(ik, jC2) + 1
              If jC3 > 0 Then Res(ik, jC3) = Res(ik, jC3) + 1
            ElseIf ArrRawdata(i, 8) = ReportType2 Then
              Res2(ik, jC) = Res2(ik, jC) + 1
              If jC2 > 0 Then Res2(ik, jC2) = Res2(ik, jC2) + 1
              If jC3 > 0 Then Res2(ik, jC3) = Res2(ik, jC3) + 1
            End If
          End If
        Next c
      End If
    End If
  Next i
End Sub
 
Upvote 0
Không nên dùng các từ "Dear All", "Ths" , bạn đọc nội qui diễn đàn sẽ rỏ
...
Có hai lý do:

Thứ nhất là chúng không hẳn lịch sự.
Đối với những người đã trải qua hai thế hệ theo Mẽo (Hai/Đía ôn), và thế hệ theo Pháp (Bông rua me xừ, Xè tú) thì đó là lối nói chuyện của pơ-tí buộc-gioa (tiểu tư sản) tự "nâng cấp" mình lên a-rít-tô-cơ-rát (quý tộc) hoặc anh-teo-léc-tua-en (trí thức)
Các từ tks, thanks này nọ cũng là Mẽo hoá của Méc-xì bố-cu ngày xưa.

Thứ hai, người sử dụng các từ Mẽo hoá và viết tắt cũng đồng thời tạo bước đầu cho người ta thấy rằng mình có tật không uốn lưỡi trước khi nói. Bạn để ý sẽ thấy những người này trưng bày vấn đề, nhẹ thì chủ quan, nặng thì cộc lốc, chẳng ai hiểu nổi.

Những người này luôn viện có rằng "diễn đàn là nơi trao đổi công nghệ, đâu phải là nơi bắt bẻ lời ăn tiếng nói"
Mặt khác, khi các công ty than thở "tuổi trẻ ngày này không có kỹ năng giao tiếp", thì họ muốn nói cái gì?
Diễn đàn là nơi trao đổi công nghệ nhưng cũng là nơi huấn luyện kỹ năng giao tiếp.
Tật xấu dễ học. Nếu diễn đàn dễ dãi với những câu hỏi cộc lốc, buộc người trả lời phải hỏi lại nhiều lần để lấy đủ chi tiết thì có phải chăng khuyến khích tật lười biếng?

Người có ý thức khách quan, lưu tâm đến việc người đọc có hiểu ý mình hay không luôn luôn nõi chuyện rất rõ ràng, tránh viết tắt, không chêm tiếng tây bồi (trừ những từ có tính khoa học, khó dịch ra tiếng Việt)
 
Upvote 0
Có hai lý do:

Thứ nhất là chúng không hẳn lịch sự.
Đối với những người đã trải qua hai thế hệ theo Mẽo (Hai/Đía ôn), và thế hệ theo Pháp (Bông rua me xừ, Xè tú) thì đó là lối nói chuyện của pơ-tí buộc-gioa (tiểu tư sản) tự "nâng cấp" mình lên a-rít-tô-cơ-rát (quý tộc) hoặc anh-teo-léc-tua-en (trí thức)
Các từ tks, Cảm ơn này nọ cũng là Mẽo hoá của Méc-xì bố-cu ngày xưa.

Thứ hai, người sử dụng các từ Mẽo hoá và viết tắt cũng đồng thời tạo bước đầu cho người ta thấy rằng mình có tật không uốn lưỡi trước khi nói. Bạn để ý sẽ thấy những người này trưng bày vấn đề, nhẹ thì chủ quan, nặng thì cộc lốc, chẳng ai hiểu nổi.

Những người này luôn viện có rằng "diễn đàn là nơi trao đổi công nghệ, đâu phải là nơi bắt bẻ lời ăn tiếng nói"
Mặt khác, khi các công ty than thở "tuổi trẻ ngày này không có kỹ năng giao tiếp", thì họ muốn nói cái gì?
Diễn đàn là nơi trao đổi công nghệ nhưng cũng là nơi huấn luyện kỹ năng giao tiếp.
Tật xấu dễ học. Nếu diễn đàn dễ dãi với những câu hỏi cộc lốc, buộc người trả lời phải hỏi lại nhiều lần để lấy đủ chi tiết thì có phải chăng khuyến khích tật lười biếng?

Người có ý thức khách quan, lưu tâm đến việc người đọc có hiểu ý mình hay không luôn luôn nõi chuyện rất rõ ràng, tránh viết tắt, không chêm tiếng tây bồi (trừ những từ có tính khoa học, khó dịch ra tiếng Việt)


Cảm ơn vì những điều trên
Bài đã được tự động gộp:

Nếu thỏa điều kiện tháng và tuần thì đếm cột tương ứng, chỉnh Private Sub Get_Res
Mã:
Private Sub Get_Res(ArrRawdata, ArrDate, ArrDefect, aCol, Dic, ReportType, ReportType2, Res, Res2)
  Dim sRow, Scol&, i&, j&, c&, ik&, jC&, jC2&, jC3&, iDate

  sRow = UBound(ArrRawdata, 1)
  Scol = UBound(ArrDate, 2)
  ReDim Res(1 To sRow, 1 To Scol)
  ReDim Res2(1 To sRow, 1 To Scol)
  For i = 1 To sRow
    iDate = ArrRawdata(i, 2)
    jC = Dic.Item(Month(iDate) & "M")
    If jC > 0 Then
      For j = 3 To UBound(aCol)
        If Not ArrRawdata(i, j) Like aCol(j) Then Exit For
      Next j
      If j > UBound(aCol) Then
        jC2 = Dic.Item(Application.WeekNum(iDate) & "W")
        jC3 = Dic.Item(iDate)
        For c = 10 To 11
          ik = Dic.Item(ArrRawdata(i, c))
          If ik > 0 Then
            If ArrRawdata(i, 8) = ReportType Then
              Res(ik, jC) = Res(ik, jC) + 1
              If jC2 > 0 Then Res(ik, jC2) = Res(ik, jC2) + 1
              If jC3 > 0 Then Res(ik, jC3) = Res(ik, jC3) + 1
            ElseIf ArrRawdata(i, 8) = ReportType2 Then
              Res2(ik, jC) = Res2(ik, jC) + 1
              If jC2 > 0 Then Res2(ik, jC2) = Res2(ik, jC2) + 1
              If jC3 > 0 Then Res2(ik, jC3) = Res2(ik, jC3) + 1
            End If
          End If
        Next c
      End If
    End If
  Next i
End Sub


Hôm qua mình viết lại mới hết dựa theo thuật toán của bạn chứ không sử dụng lại bạn à.
 
Upvote 0
Bạn có biết tiếng Việt không vậy?
Trong ngữ cảnh "cảm ơn"
"vì" là nói móc
"về" có nhiều khả năng thật tâm hơn.

Tôi đoán là bạn muốn nói trường hợp 1: nói móc.
 
Upvote 0
Web KT

Bài viết mới nhất

Back
Top Bottom