+ Reply to Thread
Results 1 to 12 of 12

Command button with 2 VBA

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Command button with 2 VBA

    Hey Community,

    I am using code to sum monthly results on commandbutton, but before counting i want to format cell A:A
    i use this code for format
    Please Login or Register  to view this content.
    but it is not working when i put both codes to same commandbutton. What can i do?

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Command button with 2 VBA

    What is the other code?
    What is in Column A? Formulas?
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    Second code is to sum monthly income, but cell on A:A i need to convert to numbers otherwise VBA not working, i put 2 command buttons step by step it is working 1st button to convert to number and second to calculate, but i want both of them to work together in same button

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: Command button with 2 VBA

    What is the result of using the macro recorder to convert to numbers and sum all in one go?
    BTW, this formats to numbers.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    it is because Range A:A is in different sheet

    How can i Range it to DATA Range A:A?

    Please Login or Register  to view this content.
    Last edited by Akbarov; 12-14-2018 at 03:16 AM.

  6. #6
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    any kind of help please?

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Command button with 2 VBA

    @akbarov

    jolivanes showed you the solution, see below

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    it is not working

    button is in sheet1 and i need it to convert sheet2A:A

    on same button i use this code

    Please Login or Register  to view this content.
    Last edited by Akbarov; 12-14-2018 at 09:17 AM.

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Command button with 2 VBA

    ok, try this (i just tested it and it works)

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    my code works aswell but only when i click button on sheet2
    i just need it to work when i click on button sheet1
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    When i click on button i get error
    Select method of range class failed

  11. #11
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: Command button with 2 VBA

    any kind of help please?

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Command button with 2 VBA

    You are missing parenthesis in you sub title
    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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: 2
    Last Post: 02-02-2016, 10:27 PM
  2. Insert Command Button that will Activate Command Button on a Different Sheet
    By realvirtuality1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2016, 02:11 PM
  3. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  4. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  5. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  6. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  7. Replies: 0
    Last Post: 11-03-2005, 11:00 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