sady
sady

Reputation: 301

VBA code to add current date in next cell

enter image description hereI have below data (attached), which I have to add manually everyday. Now, I am trying to automate it.

  1. I would want to add current date in the next cell available (Ex : Cell E1)
  2. Second cell (E2), should get the return value of rows visible after autofilter from another Sheet named "Stock".

enter image description here

Please help me with these two codes.

Upvotes: 1

Views: 664

Answers (1)

user3598756
user3598756

Reputation: 29421

Sub main()
    With Range("A1").CurrentRegion
        .Offset(, .Columns.Count).Resize(2, 1) = Application.Transpose(Array(Date, Application.WorksheetFunction.Subtotal(103, Worksheets("Stock").UsedRange.Columns(1).SpecialCells(XlCellType.xlCellTypeVisible))))
    End With
End Sub

Upvotes: 1

Related Questions