+ Reply to Thread
Results 1 to 7 of 7

Running two macros in one worksheet at the same time

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    ham, ON
    MS-Off Ver
    2007
    Posts
    3

    Running two macros in one worksheet at the same time

    Hello I'm inexperienced in VBA, been digging around and trying different things but I still can't figure out how to get my two macros to run at the same time in the same worksheet. If I open two different excel tabs and use the codes seperately, they each do their own purpose. But I can't figure out how to merge them in one excel worksheet. It seems it's not as easy as just deleting the "End Sub" and "Private Sub Worksheet_Change(ByVal Target As Range)" in the middle to combine them. When I enter something in cell B1 I would like it to cut and paste to the A column (starting at A2) and then also populate the date in the cell next to it. Here are the two macros:


    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 07-21-2014 at 10:52 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Running two macros in one worksheet at the same time

    Use the same "If Not" structure in the second routine as you have in the first. Include an "Exit Sub" before the last "End If" in each case ... and simply combine the routines.

    You might need to consider where, if anywhere, to include the Target.Cells.Count check


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Running two macros in one worksheet at the same time

    Please use CODE tags when posting code.

    Try this:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    07-16-2014
    Location
    ham, ON
    MS-Off Ver
    2007
    Posts
    3

    Re: Running two macros in one worksheet at the same time

    Sorry for the wrong format. I tried using that code but it only posts the date when you manually enter a value in one of the A column cells, not automatically after it cuts the value from B1 and pastes it in the A column. Is there a way to cut and paste the B1 value into A column and get the date next to it just from entering a value in B1 alone?

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Running two macros in one worksheet at the same time

    Yes, a small adjustment, makes it:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-16-2014
    Location
    ham, ON
    MS-Off Ver
    2007
    Posts
    3

    Re: Running two macros in one worksheet at the same time

    Thank you! This macro works when I enter something in B1 on sheet 3, how would I be able to alter it so instead it does the exact same procedure except it activates and takes values from sheet 1 F1 instead? I'm guessing you have to change Range("B1")?

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Running two macros in one worksheet at the same time

    So you want it to take values entered in F1 on Sheet1, and write them to the next unused row in Column A of Sheet3?

    Enter this code in the worksheet module for Sheet1:

    Please Login or Register  to view this content.

+ 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. [SOLVED] how to keep macros from running at the same time?
    By scottatbuckman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-26-2014, 12:06 PM
  2. Prevent two macros from running at the same time
    By Kreef in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2011, 10:36 PM
  3. Running Macros based on Worksheet changes in Excel 2007
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2010, 05:52 PM
  4. Running Macros in protected worksheet
    By 37Seconds in forum Excel General
    Replies: 6
    Last Post: 01-09-2007, 03:31 PM
  5. [SOLVED] Editing worksheet while running macros
    By eight02645999@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-30-2005, 05:05 AM

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