Closed Thread
Results 1 to 2 of 2

Splitting macros in spin box

  1. #1
    Registered User
    Join Date
    08-14-2015
    Location
    Southampton, England
    MS-Off Ver
    MS 2010
    Posts
    5

    Splitting macros in spin box

    Please ignore as now closed.


    Hi all,

    I am recording mutliple macros and am looking at using spin box. Basically, I have done it that when I click on 'spin down' once it should add a tenderer and if I click on 'spin up' it adds a tenderer (done this by copying the recorded macros). What I want it to do is if I click on 'spin down' another time it adds another tenderer (I want to do this a maximum of two times), I just don't know how to split the code. Would a list be easier? Whereby I can select the number of tenderers (1,2,3,4,etc) and based on the number chosen it will add that number of tenderers, if that makes sense? It's only copying a few cells, then when I am recording, I can make sure the formulas are correct.

    The code for the spin box is below (trying to split macro 1 and 3 and 2 and 4, then any others that I add):


    Private Sub SpinButton21_SpinDown()
    ' Macro1 Macro
    '

    '
    Range("B29:D34").Select
    Selection.Copy
    Range("F29").Select
    ActiveSheet.Paste

    ' Macro3 Macro
    '

    '
    Range("B22:D27").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("J29").Select
    ActiveSheet.Paste
    Range("J29:L29").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "Tenderer 6"
    Range("N28").Select
    End Sub


    Private Sub SpinButton21_SpinUp()
    ' Macro2 Macro
    '

    '
    Application.CutCopyMode = False
    Range("F29:H34").Select
    Selection.Clear
    With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorDark1
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("J30").Select

    ' Macro4 Macro
    '

    '
    Range("J29:L34").Select
    Selection.Clear
    With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorDark1
    .TintAndShade = 0
    .PatternTintAndShade = 0
    End With
    Range("D19").Select
    End Sub
    Last edited by BumbleBob; 09-02-2015 at 11:51 AM. Reason: Closed

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Splitting macros in spin box

    I am officially closing this thread per your request, but please be aware of our rules.

    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 here
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help with Spin Button. Set Spin button starting value based on a text box value
    By etuckram in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-18-2014, 10:05 AM
  2. [SOLVED] Spin Button Help
    By esaban in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2014, 07:13 AM
  3. Spin Button
    By LeeGro in forum Excel General
    Replies: 6
    Last Post: 06-20-2014, 06:02 PM
  4. Splitting and renaming mailmerge doc - new to macros!
    By Debbieannbee in forum Word Formatting & General
    Replies: 7
    Last Post: 03-27-2014, 11:28 AM
  5. Macros with buttons, spin buttons, scroll buttons, etc.
    By qqbbppdd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-12-2013, 09:34 AM
  6. Spin Button:spin cells A7
    By ice in forum Excel General
    Replies: 1
    Last Post: 03-16-2007, 02:23 PM
  7. Spin box min/max
    By biztools in forum Excel General
    Replies: 2
    Last Post: 03-21-2006, 01: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