Last active
September 6, 2020 15:48
-
-
Save mrioqueiroz/3412f6b09f091eb4b678b33abbaf389c to your computer and use it in GitHub Desktop.
Trechos de macros para testes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub AddDateAndTimeMultipleTimes() | |
Dim userInput As Variant | |
userInput = Application.InputBox("How many times?") | |
If Not userInput = "" Then | |
For i = 1 To userInput | |
Call AddDateAndTimeOnce | |
Next i | |
ElseIf userInput = "" Then | |
Call AddDateAndTimeOnce | |
End If | |
End Sub | |
Sub AddDateAndTimeOnce() | |
ActiveCell.Value = Date | |
ActiveCell.Offset(0, 1).Select | |
ActiveCell.Value = Hour(Now) & ":" & Minute(Now) | |
ActiveCell.Offset(1, -1).Select | |
End Sub | |
Sub ClearAllFilters() | |
On Error Resume Next | |
If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData | |
End Sub | |
Private Sub filtrarVarios() | |
Dim criterios As String | |
criterios = Application.InputBox("Favor inserir os critérios separados por vírgula:") | |
If InStr(criterios, ",") = 0 Then Exit Sub | |
ActiveCell.AutoFilter _ | |
Field:=(ActiveCell.Column - Selection.Columns.Count), _ | |
Criteria1:=Split(criterios, ","), _ | |
Operator:=xlFilterValues | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment