this is my MACRO CODE
Sub PrintDate(from As String)
Sheets("Date").Select
Range("A1").Select
ActiveCell.Formula2R1C1 = "=SEQUENCE(7,1,"from")"
End Sub
I am trying to passing this date into this code but its not working properly
You can add below if you would like to format the date column:
Sub PrintDate(from As String)
Dim lastrow As Integer
Sheets("Date").Select
Range("A1").Select
ActiveCell.Formula2R1C1 = "=SEQUENCE(7,1," & """" & from & """" & ")"
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:A" & lastrow).NumberFormat = "m/d/yyyy"
Range("A1").Select
End Sub
Working when you change the macro line to
ActiveCell.Formula2R1C1 = "=SEQUENCE(7,1," & """" & from & """" & ")"
Hi @Rampage
That means the formula is incorrect.
So, at first correct the formula in Excel and only then call it from PAD in order for it to work.
What are you trying to achieve with the formula?
Please provide as much details as possible.
Yeah i try with this.....
giving input like this,
not getting expected output
Clearly the string parameter is showing up the error in the macro
Change the line as below after removing the quotes-
ActiveCell.Formula2R1C1 = "=SEQUENCE(7,1,from)"
After doing this, fix the macro first in the Excel and only then call from PAD.
See how the Sequence formula function is used
How to use the Excel SEQUENCE function | Exceljet
eetuRobo
11
Super User 2025 Season 1
KO-05050229-0
4
Brad Darragh
4