+ Reply to Thread
Results 1 to 5 of 5

Two Separate VBA Statements That I'd Like to Run Together

  1. #1
    Registered User
    Join Date
    11-07-2014
    Location
    Indianapolis, Indiana
    MS-Off Ver
    2013
    Posts
    6

    Two Separate VBA Statements That I'd Like to Run Together

    Hello,

    This is my first time posting and I am also VERY new to VBA.


    My overall goal is to copy and paste data on my "Master Data" tab into a "Master Data History" tab and then clear the contents that were moved from the "Master Data" tab. The data that would be moved is flagged in Column K with an "X" - once Column K is flagged "X", the information from the row from Columns A:K would all be moved to the "Master Data History" tab.

    After doing some extensive research on the forums, I was able to find and tailor a two bits of coding that work the way I would like them to individually, but I can't figure out how to get them to run simulataneously one after the other. Is this even possible?



    First code (copies data from A thru K in a row that is flagged "X" and pastes in last row on "Master Data History" tab)

    Please Login or Register  to view this content.


    Second code (clears contents in Columns A thru K on "Master Data" that has been flagged with an "X" in column K)

    Please Login or Register  to view this content.


    Lastly, if possible, I would also like to add a code that would autofit columns to all data on both tabs.


    I apologize in advance if this isn't very clear and will gladly answer any questions that would help clarify the ask.

    Thank you
    Last edited by alansidman; 03-01-2015 at 04:56 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Two Separate VBA Statements That I'd Like to Run Together

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Two Separate VBA Statements That I'd Like to Run Together

    You should be able to make this happen by taking the code below (from your second event) and pasting it

    Please Login or Register  to view this content.
    just before the line of code

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-07-2014
    Location
    Indianapolis, Indiana
    MS-Off Ver
    2013
    Posts
    6

    Re: Two Separate VBA Statements That I'd Like to Run Together

    Alansidman, thank you for the help - this worked exactly as intended. I apologize for not following the forum rules and will pay closer attention to them in the future.

    Thank you again

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,865

    Re: Two Separate VBA Statements That I'd Like to Run Together

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Combining two separate if statements depending on a condition
    By rundrm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-25-2013, 12:34 AM
  2. Macro Help - If Statements for two separate values
    By excelnoobies in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-09-2013, 05:11 AM
  3. Help make VBA code more elegant. Lots of separate IF statements.
    By drjanand in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2012, 12:03 PM
  4. Two Separate IF statements in one sub
    By Gaskell in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-22-2012, 10:10 AM
  5. Combining separate IF Statements
    By mgollwit in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2011, 12:43 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