Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
Jun 26, 2022
Solved

Error showing Expected Array for VBA to name file name in column

I would like to name Range("A1") as May22 which can be extracted from the filename.   However when the code was executed, error message was triggered: Expected Array. Sub copyfilename () Dim ws ...
  • HansVogelaar's avatar
    Jun 26, 2022

    hrh_dash 

    Change the declaration of columnName to

     

    Dim columnName() As String

     

    The () make columnName an array.

Resources