+ Reply to Thread
Results 1 to 4 of 4

Two macros one button

  1. #1
    Registered User
    Join Date
    07-13-2015
    Location
    Slovakia
    MS-Off Ver
    2007, 2010, 2013
    Posts
    76

    Two macros one button

    Hello,

    is it possible to combine two macros in one button? I have this two macros and i want to run second one, once the first one is completed automatically.


    first macro:


    Sub addcell()
    Dim i As Long
    For i = Range("A" & Rows.Count).End(3).Row To 2 Step -1
    If Cells(i, "A") <> "" Then Cells(i + 1, "A").Insert
    Next i
    End Sub




    second macro:

    Sub RemoveRows()

    Dim i As Long

    i = 1

    Do While i <= ThisWorkbook.Worksheets("Hárok2").Range("A1").CurrentRegion.Rows.Count

    If InStr(1, ThisWorkbook.Worksheets("Hárok2").Cells(i, 1).Text, "-", vbTextCompare) > 0 Then
    ThisWorkbook.Worksheets("Hárok2").Cells(i, 1).EntireRow.Delete
    Else
    i = i + 1
    End If

    Loop

    End Sub






    any simple suggestions?

  2. #2
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Two macros one button

    Yup....
    You can run only the first macro...it will run the second macro once first macro is completed.

    Please Login or Register  to view this content.
    Click *Add Reputation to say Thank and Don't forget to mark threads as "Solved" .
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  3. #3
    Registered User
    Join Date
    07-13-2015
    Location
    Slovakia
    MS-Off Ver
    2007, 2010, 2013
    Posts
    76

    Re: Two macros one button

    Itś working just fabulous... Thanks

  4. #4
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: Two macros one button

    Please do the following....Cheers..
    Click *Add Reputation to say Thank and Don't forget to mark threads as "Solved" .

+ 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. Replies: 1
    Last Post: 10-02-2013, 09:05 PM
  2. [SOLVED] 2 macros in one button?
    By hond in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-11-2012, 07:22 AM
  3. Stop All Macros Via Button
    By waqarqrl in forum Excel General
    Replies: 0
    Last Post: 08-28-2012, 02:03 PM
  4. Trying to add button using VBA macros
    By mail2mmk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2009, 08:04 AM
  5. Button macros
    By johnnny5 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2007, 05:11 AM
  6. 1 button for 2 macros
    By lunker55 in forum Excel General
    Replies: 5
    Last Post: 06-20-2005, 02:05 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