+ Reply to Thread
Results 1 to 8 of 8

Automatically change file name when conditional formula is true

  1. #1
    Forum Contributor
    Join Date
    11-06-2021
    Location
    Tripoli
    MS-Off Ver
    Still using 2007 in 2023
    Posts
    289

    Cool Automatically change file name when conditional formula is true

    Hello everyone,

    I hope you're all fine today. I've developed VBA code (below) that generates Excel files based on a template excel file(attached below). Now, I'm seeking assistance to further automate the process for working with these generated XLSX files.

    Specifically, I need help with a single automation step that involves renaming these Excel files. The renaming should only occur when a certain condition is met, indicated by the presence of a highlighted green color in column A, indicating condition is achieved.

    To elaborate, I'm looking for a way to automatically add the word "checked" to the excel filename if and only if the condition(green color) in the file is satisfied. The condition is related to a specific formula in column A (sheet 1), which is to highlight $A$1:$A$2040 in green.

    I'm open to any suggestions on how to achieve this automation in the most efficient manner and that requires minimal CPU power.

    Thank you in advance for your support and expertise.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Automatically change file name when conditional formula is true

    Hi, I have not downloaded your file but what you should do is add a variable newFileName
    Fill it with the current filename
    Before the wb.Close you add a check for that green column if it's green you edit the newfilenam to include the word "checked"
    ins tead of wb.Close you do a wb.saveas with the new filename and kill the old file name or just close and save as you have noe.
    I'll try and woirk it out but hope the idea puts you in the right track.
    Since you've developed the VBA code this won't be too difficult for you
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Automatically change file name when conditional formula is true

    Try this:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Automatically change file name when conditional formula is true


    Quote Originally Posted by hasan mougharbel View Post
    I'm open to any suggestions on how to achieve this automation in the most efficient manner and that requires minimal CPU power.
    Hello,

    for this the obvious is to avoid Excel and use a database software !

    Anyway rather than a guessing challenge according to your Excel VBA procedure
    in order to remove the useless - almost all actual code to trash ! - to be more efficient
    you must create a new thread with your best elaboration of the VBA procedure purpose without anything to guess
    and accordingly an attachment with a well reflective workbook (before & after states) without forgetting the csv text file …

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Automatically change file name when conditional formula is true

    The code explains what the result is the OP want.
    No need (as I can see) for the csv files or whatever, just the code modification to do what the OP wants to achieve, no guessing for as far as I can see

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Automatically change file name when conditional formula is true


    Hi Keebellah,

    my previous post is based upon a specific initial post comment which has no link with this thread purpose according to filename
    so my comment has no relation with the help you shared, the reason why I advised to create a new thread …

    By the way your code message box text looks so weird !
    Last edited by Marc L; 08-16-2023 at 05:17 PM.

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Automatically change file name when conditional formula is true

    Okay, the text looks weird because it's arabic

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Automatically change file name when conditional formula is true


    Thanks. It looks specific as this codeline does not exist in the original code …

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 07-23-2023, 07:35 AM
  2. [SOLVED] Conditional formatting color change if any in row is true
    By CLSSY56 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-08-2018, 11:59 AM
  3. Formula to automatically change the date in a file name
    By troosers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2015, 06:01 AM
  4. Help popup window if condition is TRUE in change event if conditon is true
    By fanku in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-09-2014, 12:46 PM
  5. How to change the formula by its calculated value if condition is true ?
    By Jeferson11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2013, 07:30 PM
  6. Automatically Change Conditional Formating
    By clacketyclack in forum Excel General
    Replies: 6
    Last Post: 05-15-2012, 02:20 PM
  7. [SOLVED] how do i get a TRUE value in a formula to change the color of the.
    By blopreste3180 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2005, 01:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1