+ Reply to Thread
Results 1 to 2 of 2

duplicate a macro button for every row

  1. #1
    Registered User
    Join Date
    06-20-2015
    Location
    england
    MS-Off Ver
    2010
    Posts
    1

    duplicate a macro button for every row

    Hi there,

    Very very new to excel/macros etc.
    working in excel 2010.
    I have created a macro button that changes the value of one cell, to the value of another cell.

    E.g. when the button is pressed, the value in B2 changes to whatever value is in B1

    here -

    Sub Stock_up()
    Range("F2").Value = Range("E2").Value
    End Sub


    i'd like to somehow just 'drag down' the buttons, like can be done with formula in excel cells. it is a basic stock control spreadsheet i am creating.

    Also, as a bonus extra, i'd like to create some kind of conditional formatting, where upon if ANY of values in column B show a specific value (0), then a separate cell shows up red, or whatever.
    e.g. b1, b2 and b3 all have values of 3, but b4 has a value of 0. Or, b1 and b3 have values of 3, but b2 and b4 have values of 0. i'd like cell D5 to fill red upon this 0 value, in any cell.

    Thank you kindly

    Katie x

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: duplicate a macro button for every row

    Hi and welcome to the forum.

    There are two types of buttons you can put on a worksheet; ActiveX-type and Form-Type
    Overview of forms, Form controls, and ActiveX controls on a worksheet

    For future reference, please state what type of worksheet controls you are using.

    The method below uses Form-type buttons because you can assign one macro to all the buttons. The macro figures out the row number of the button that called it.
    • Put a Form-type button on your sheet and assign this macro to it.
    • Then copy the cell that contains the button and paste it in as many rows as you like.

    Please Login or Register  to view this content.

    Also, as a bonus extra, i'd like to create some kind of conditional formatting, where upon if ANY of values in column B show a specific value (0), then a separate cell shows up red, or whatever.
    e.g. b1, b2 and b3 all have values of 3, but b4 has a value of 0. Or, b1 and b3 have values of 3, but b2 and b4 have values of 0. i'd like cell D5 to fill red upon this 0 value, in any cell.
    Use this as the CF formula in cell D5
    =COUNTIF(B1:B4,0)>0
    Last edited by AlphaFrog; 06-21-2015 at 05:05 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

+ 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. stoping duplicate record of data with double click of macro button
    By ajleeds in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-14-2014, 10:43 PM
  2. [SOLVED] Macro button copies sheet containing a macro button as an image
    By namso1902 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2013, 03:51 PM
  3. VBA Button to generate a number which does not duplicate ~ criteria based
    By opattison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2012, 09:38 AM
  4. A macro to create a form button, assign a macro and name the button
    By cl361 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2008, 01:07 AM
  5. Creating Button to duplicate cells
    By UBERMASS in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-18-2007, 10:17 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