cbtm
Thành viên mới
PHP:
Function Find_Range(Find_Item As Variant, _
Search_Range As Range, _
Optional LookIn As Variant, _
Optional LookAt As Variant, _
Optional MatchCase As Boolean) As Range
Dim c As Range
If IsMissing(LookIn) Then LookIn = xlValues
If IsMissing(LookAt) Then LookAt = xlWhole
If IsMissing(MatchCase) Then MatchCase = True
With Search_Range
Set c = .Find( _
What:=Find_Item, _
LookIn:=LookIn, _
LookAt:=LookAt, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=MatchCase, _
SearchFormat:=False)
If Not c Is Nothing Then
Set Find_Range = c
firstAddress = c.Address
Do
Set Find_Range = Union(Find_Range, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End Function
PHP:
Private Sub CommandButton1_Click()
Sheets("MAI TU").Range("A65000").End(xlUp).Offset(1, 0).Select
With ActiveCell
.Value = UserForm1.DTPicker3.Value
.Offset(0, 1).Value = UserForm1.TextBox1.Value
.Offset(0, 2).Value = UserForm1.TextBox2.Value
.Offset(0, 3).Value = Val(UserForm1.TextBox1.Value) * Val("60%") / Val("100")
.Offset(0, 4).Value = "=RC[-1]/2-RC[-2]"
.Offset(0, 5).Value = "=RC[-2]/2+RC[-3]"
.Offset(0, 6).Value = "=RC[-1]+RC[-2]"
End With
End Sub
PHP:
Private Sub finddate()
Sheets("Sheet1").Select
Dim iNumber
For iNumber = UserForm1.DTPicker1.Value To UserForm1.DTPicker2.Value Step 1
On Error Resume Next
Find_Range(iNumber, Columns("A"), MatchCase:=True).EntireRow.Delete
Next iNumber
Cells.Select
Selection.ColumnWidth = 8.43
Range("A65536").End(xlUp).Select
End Sub
PHP:
Private Sub CommandButton7_Click()
Dim MoneyCount
Range("A1").Select
Do Until ActiveCell.Value = Empty
If ActiveCell.Value = "DATE" Then
ActiveCell.Offset(1, 0).Select
ElseIf Day(DateValue(ActiveCell.Value)) = Day(DateValue(UserForm1.DTPicker1.Value)) Or
Day(DateValue(ActiveCell.Value)) > Day(DateValue(UserForm1.DTPicker1.Value)) And _
Day(DateValue(ActiveCell.Value)) = Day(DateValue(UserForm1.DTPicker2.Value)) Or _
Day(DateValue(ActiveCell.Value)) < Day(DateValue(UserForm1.DTPicker2.Value)) Then
MoneyCount = (MoneyCount * 1) + (ActiveCell.Offset(0, 6).Value * 1)
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(0, 1).Select
End If
Loop
UserForm1.TextBox3.Value = MoneyCount
End Sub
PHP:
Private Sub CommandButton8_Click()
With UserForm1
.TextBox4.Value = "$" & WorksheetFunction.Sum(Range("E:E"))
.TextBox5.Value = "$" & WorksheetFunction.Sum(Range("F:F"))
.TextBox3.Value = "$" & WorksheetFunction.Sum(Range("G:G"))
End With
End Sub
Lần chỉnh sửa cuối: