Excel VBA Code Help needed please - Still learning

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Charliebear
    New Member
    • Sep 2015
    • 1

    Excel VBA Code Help needed please - Still learning

    Please help
    I have a worksheet I update monthly using Microsoft query.
    The information is collated and summarised in the attached worksheet.

    I need a small VBA code Based on a command button to.
    1. Request the Month/Year (APR-15)

    Then using the user input copy the Total value from F9 and copy it to the Cell in D based on the matching month in C

    This is a small step I know and can do it manually however once I have this working I will move forward. I am trying to teach myself VBA but am struggling here.

    Thanks
    Attached Files
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Charliebear:
    1) You'll find that un-requested files are not usually downloaded by our moderators or experts for various reasons.
    2) Requests for "final code" without showing your efforts are often ignored. (Please see the FAQ section)

    SO, what to do?
    If you have your code ({alt}{F11} will open the VBA editor) copy and paste it here, then select that pasted text and click on the [CODE/] formatting option in the toolbar.

    Post a small example of your data
    Use the [CODE/] formatting option in the toolbar to preserve the column formatting and spaces (not the tab key :) ) to space your columns.

    Once we have that we can go from there.

    Some tips:
    Open any Office-word/excel/database>
    <alt><F11> to open the VBA editor...
    Menu>Tools>Opti ons>
    >Editor tab, UNCHECK "auto Syntax Check" you're vba code will still highlight if in error, just

    no annoying message boxes while you type!
    >CHECK the "Require Variable Declaration" option --- you will now have to use the

    "DIM...variable name....typecas te" construct in your code. Highly advised.
    Everything else on this tab check, I prefer the tab step to be either 2 or 4 spaces.
    >The other tabs are good as is for most people, review if you want.

    You may find this introductory tutorial site helpful:
    www.homeandlear n.org>Excel VBA For Complete Beginners
    PLEASE DO NOT DO THIS as suggested in the tutorial:
    In order to run macros without any annoying security warnings, click on Macro Security, on the Code panel. Select the option for Enable all macros. Then make sure that "Trust access to the VBA object model" is checked:
    Set the security to "Disable with Notification" - IMHO the "annoying security prompt" is better than opening some file from a friend or colleague that wipes out all of your hard work!



    Thnx
    -z
    Last edited by zmbd; Oct 24 '15, 06:00 PM.

    Comment

    Working...