Consulting

Results 1 to 4 of 4

Thread: Solved: Drop Down List

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

    Solved: 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
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    You might try something simple like:
    [VBA] Range("D4").ClearContents[/VBA]
    where cell D4 is the cell with your drop down. Put it at the end of your sub.
    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.
    [VBA]
    Sub ChangeDropDownToJanuary()
    'Select The "Totals" Worksheet
    Sheets("Totals").Select

    'Change The Year On The Jan Sheet
    Cells(1, 19).Value = "JANUARY"

    End Sub
    [/VBA]

    Thanks
    Gary

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Or this to put january in the cell:
    [VBA]ActiveSheet.Range("D4").Value = "January"[/VBA]
    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
  •