+ Reply to Thread
Results 1 to 7 of 7

Macro Button Inputting into Any Cell

  1. #1
    Forum Contributor
    Join Date
    07-02-2012
    Location
    UK
    MS-Off Ver
    365/2008
    Posts
    152

    Macro Button Inputting into Any Cell

    I have a button macro, specifying a cell to input a value to, but if I highlight any other cell on the worksheet then select the button, the value is input in the highlighted cell. I've protected the sheet but had to leave two cells unprotected...these being the cell (D1) the macro is to place the value "South" and a cell with a defined drop down list. But if a user makes a selection from the drop down, then selects a macro button, the value is input in the drop down cell.

    Is there any way of stopping this from happening?

    My vba for the button is:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Macro Button Inputting into Any Cell

    I don't understand what exactly is required.

    However, try this

    Please Login or Register  to view this content.
    Cheers!
    Deep Dave

  3. #3
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: Macro Button Inputting into Any Cell

    Is there any way of stopping this from happening?
    Not with the code as it is - whatever cell is selected will be updated and you don't give enough information to suggest any possible answers.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Macro Button Inputting into Any Cell

    If the user makes a selection from the drop down then that cell becomes the active cell so your code is doing what it's meant to.

    Do you mean after they make a selection you want D1 to update to say "South"?

    In which case, why not just use
    Please Login or Register  to view this content.
    ?

    BSB

  5. #5
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Macro Button Inputting into Any Cell

    NOTE - by using ActiveCell the code does something to the cell where the cursor is currently sitting

    If you want a specific cell to take a value/formula then use something like
    Please Login or Register  to view this content.
    Or you could use your original code and exclude other cells/columns.rows etc This would put the entry only in cells in row2 but only if cursor was in that cell
    Please Login or Register  to view this content.
    This combination would only put the entry in cell E2
    Please Login or Register  to view this content.

    erc
    Last edited by Kevin#; 04-22-2016 at 05:06 AM.
    If a response has helped then please consider rating it by clicking on *Add Reputation below the post
    When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)

  6. #6
    Forum Contributor
    Join Date
    07-02-2012
    Location
    UK
    MS-Off Ver
    365/2008
    Posts
    152

    Re: Macro Button Inputting into Any Cell

    Thank for the help.
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    both work as I need so thank you.

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,891

    Re: Macro Button Inputting into Any Cell

    Happy to help.
    Thanks for the rep point

    BSB

+ 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. Automatically add button when data added to cell and apply macro to button?
    By dori2o in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2016, 11:56 AM
  2. removing or changing data in a cell by inputting date in another cell
    By markac in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-05-2014, 09:39 AM
  3. [SOLVED] Button for adding a new line across multiple sheets, inputting data to certain cells
    By jamief in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2014, 08:40 PM
  4. Inputting text into a macro
    By djchapple in forum Excel General
    Replies: 1
    Last Post: 09-04-2011, 02:45 PM
  5. writing a data inputting macro.
    By skatmandu2002 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2010, 09:22 PM
  6. Cell Inputting
    By Supdem in forum Excel General
    Replies: 6
    Last Post: 10-05-2009, 10:34 AM
  7. [SOLVED] Help Inputting a Name in a Macro
    By atrscomputers@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2005, 12:06 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