inputbox to select the cell for

  • Hello,

    I’m suddenly struggling to find right VBA to get done with the job. A system creates every 2 minutes an Excel file like Error_2021.12.15_170909.xlsx

    The user will select a cell in a Master-Sheet to populate the name of the source file and move it to the Backup Folder.

    I find below some VBA examples but it should be added 3 conditions:

    1-Select exact source file is created two minutes ago, without open file (maybe with VBscript).

    2-Pop up inputbox to select the cell for source file name

    3-After click on Ok, it should move the file to "C:\Backup\" folder.

    Sub EnterFName()
    Dim FName As Variant
    FName = Dir("C:\TEMP\Error_*")
    While FName <> ""
    ActiveCell.Value = FName
    FName = Dir
    End Sub

    Thanks for the help

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


  • maybe it was my mistake.

    I don’t try to rename the source file, I try to get only the file name and put it to a cell. That is all!

    If you run the code





    the code cannot take the last one!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!