0

Have code that generates an output with both today's date as well as the previous date run, i am trying to find a code that would select all information with today's date as the timestamp cut it and paste it into a new sheet.

Example of points on sheet -some columns

amount_eur fx_Timestamp
500,000 06/22/2023
550,000 06/23/2023

Am relatively new to VBA

Have tried

Sub Filter_Today()
    '
    'Filter_Today Macro
    With Worksheets("Sheet1")
        .Range("S1").AutoFilter field:=19, Criteria1:=xlFilterToday, Operator:=xlFilterDynamic
    End With
End Sub


Sub AddNewSheetswithNameExample1()
    Sheets.Add.Name = "Today"
End Sub


Sub vba_copy_titles_to_another_worksheet()
    Range("A1:S1").Copy Worksheets("Today").Range("A1")
End Sub


Sub Paste_Range()
    Range("A2:S10000").Cut Worksheets("Today").Range("A2")
End Sub

the last sub I was hoping would only cut and paste the visible information but it also selects information filtered out. Was wondering how to get around this in particular.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73

1 Answers1

0

Apply SpecialCells method something like this

Sub Paste_Range()
    Range("A2:S10000").SpecialCells(xlCellTypeVisible).Cut Worksheets("Today").Range("A2")
End Sub

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
Black cat
  • 1,056
  • 1
  • 2
  • 11