Notifications
Announcements
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
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
Yeah i try with this.....
giving input like this,
not getting expected output
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.
Working when you change the macro line to
ActiveCell.Formula2R1C1 = "=SEQUENCE(7,1," & """" & from & """" & ")"
You can add below if you would like to format the date column:
Sub PrintDate(from As String)Dim lastrow As IntegerSheets("Date").SelectRange("A1").SelectActiveCell.Formula2R1C1 = "=SEQUENCE(7,1," & """" & from & """" & ")"lastrow = Cells(Rows.Count, "A").End(xlUp).RowRange("A1:A" & lastrow).NumberFormat = "m/d/yyyy"Range("A1").SelectEnd Sub
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 519 Super User 2025 Season 2
Tomac 296 Moderator
abm abm 232 Most Valuable Professional