Results 1 to 8 of 8

Code works in macro but not command button

Threaded View

  1. #1
    Registered User
    Join Date
    09-10-2009
    Location
    Perth, Western Australia
    MS-Off Ver
    Excel 2013
    Posts
    47

    Code works in macro but not command button

    Hi there
    I've got the code below which works fine when I run it from a macro but when I put it behind a command button it only puts an 'A' into row N2 and no further. I wonder if anyone can explain why.

    Thanks, as always, for any help anyone can provide.

    datafiend

    Worksheets("Class A").Select
        Dim lastRow As Long
        lastRow = Range("C" & Rows.Count).End(xlUp).Row
    
        ActiveSheet.Range("N1").Select
        ActiveCell.FormulaR1C1 = "Classifier"
        ActiveSheet.Range("N2").Select
        ActiveCell.FormulaR1C1 = "A"
        Range("N2").AutoFill Destination:=Range("N2:N" & lastRow)
    Last edited by datafiend; 12-10-2014 at 02:58 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code fails when ran within Userform, but works when ran from Macro button on worksheet.
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 11-29-2013, 02:28 AM
  2. [SOLVED] code behind the command button that runs another macro
    By Vogelmann in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2012, 06:04 AM
  3. [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
  4. Replies: 3
    Last Post: 05-05-2006, 06:35 PM
  5. Replies: 1
    Last Post: 04-06-2005, 10:06 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