+ Reply to Thread
Results 1 to 6 of 6

Combining 2 macros

  1. #1
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Combining 2 macros

    Can anyone assist in how I can combine the following 2 macros
    I need to do the delete first

    they are as follows

    HTML Code: 
    and
    HTML Code: 
    What I want is to click one button not 2

    Assistance appreciated

  2. #2
    Registered User
    Join Date
    04-09-2013
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 365
    Posts
    29

    Re: Combining 2 macros

    Sub Button2_Click()
    Dim sh As Worksheet, ws As Worksheet, Fr As Range, c As Range
    Dim Rws As Long, Rng As Range
    Set sh = Worksheets("DataTable")
    Set ws = Worksheets("SalesPerson")
    Set Fr = ws.Range("C4")
    With sh
    Rws = .Cells(Rows.Count, "L").End(xlUp).Row
    Set Rng = .Range(.Cells(5, "L"), .Cells(Rws, "L"))
    For Each c In Rng.Cells
    If c = Fr Then
    ws.Cells(Rows.Count, "C").End(xlUp).Offset(1, 0) = c.Offset(0, -9)
    End If
    Next c
    End With
    ActiveSheet.Range("C6:C300").Select
    Selection.ClearContents
    End Sub

  3. #3
    Registered User
    Join Date
    04-09-2013
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 365
    Posts
    29

    Re: Combining 2 macros

    or put it at the beginning. my bad

  4. #4
    Banned User!
    Join Date
    10-29-2012
    Location
    Europe
    MS-Off Ver
    2013, 2016
    Posts
    318

    Re: Combining 2 macros

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Combining 2 macros

    It needs to clear the cells c4 downwards first then apply the 2nd macro
    what I have at the moment is the clearing last

    Appreciate your assistance

  6. #6
    Forum Contributor
    Join Date
    03-09-2007
    Location
    Australia
    MS-Off Ver
    Office 10
    Posts
    371

    Re: Combining 2 macros

    Thanks I was able to create a combine Macro which did the trick
    Thanks for the help

    regards

    B

+ 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 Macros
    By davidmajorwhite in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 07-28-2014, 02:55 PM
  2. [SOLVED] Combining 2 macros to run together
    By JohnnyBoyxxx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2013, 12:55 PM
  3. Combining two macros.
    By TERRI LEE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2012, 03:56 AM
  4. [SOLVED] Combining Macros
    By Clue_Less in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2012, 01:46 PM
  5. combining Macros
    By xcelwannabee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-26-2009, 09:02 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