Consulting

Results 1 to 4 of 4

Thread: Drop Down List

  1. #1
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location

    Drop Down List

    I have a drop down list which includes the months of the year. I have a sub that copies the current file, and creates a new year file by naming it with a different name and zeroing out data. The only thing is that the drop down list stays on what if was last, this case December. Is there a way to force the drop down to go to January when my sub creates the new year file? The drop down list was not created in vba, it was created on the worksheet using data validation.
    Thanks
    Gary

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,321
    Location
    You might try something simple like:
     Range("D4").ClearContents
    where cell D4 is the cell with your drop down. Put it at the end of your sub.
    Last edited by Aussiebear; 03-07-2025 at 10:16 AM.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location
    Disreguard, I automatically thought I would lose the drop down list if I forced a value in the cell. The following worked without losing the dropdown list.
    Sub ChangeDropDownToJanuary()
        ' Select The "Totals" Worksheet
        Sheets("Totals").Select
        ' Change The Year On The Jan Sheet
        Cells(1, 19).Value = "JANUARY"
    End Sub
    Thanks
    Gary
    Last edited by Aussiebear; 03-07-2025 at 10:17 AM.

  4. #4
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,321
    Location
    Or this to put January in the cell:
    ActiveSheet.Range("D4").Value = "January"
    Last edited by Aussiebear; 03-07-2025 at 10:18 AM.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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