+ Reply to Thread
Results 1 to 6 of 6

SOLVED - "ActiveCell" now doesn't work

  1. #1
    Registered User
    Join Date
    11-18-2011
    Location
    Dorset
    MS-Off Ver
    Excel 365
    Posts
    37

    SOLVED - "ActiveCell" now doesn't work

    I created a "Button" on the spreadsheet, and wrote a routine to be followed opn clicking the button. This was so that I could easily test the routine. Once it worked as I wanted, I deleted that Button, and instead created a Button on the "Add-in" Tab of the command bar; obviously, calling that same routine.

    This routine starts by testing that the cursor is in Column A, and then tests that various related cells have certain information. If that is correct, the routine then carries out some calculations, inserts some lines and inserts various formula into various cells.

    It did all work just FINE - until I changed the entry from a Button on the Sheet to one on the Command Bar

    But the very first line fails !
    ---------------------------------
    Public Sub AddDim()

    Dim myCell As Range

    myCell = ActiveCell
    ---------------------------------
    Run time error 91
    Object variable or With block variable not set.
    --------------------------------------
    Last edited by RobinClay; 08-12-2019 at 11:12 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: "ActiveCell" now doesn't work

    Hello Robin,

    Try this:-

    From:-

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    I hope that this helps.

    Cheerio,
    vcoolio.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,532

    Re: "ActiveCell" now doesn't work

    I would have thought
    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    11-18-2011
    Location
    Dorset
    MS-Off Ver
    Excel 365
    Posts
    37

    Re: "ActiveCell" now doesn't work

    Thank you, vcoolio and TMS

    That works just FINE !

    But... I am curious as to why it worked before, but not this time ?
    And what the logic is, i.e. under what circumstances must I use "SET" ?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,532

    Re: SOLVED - "ActiveCell" now doesn't work

    You're welcome.


    You use Set for an object. I don't know why it worked before.




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: SOLVED - "ActiveCell" now doesn't work

    You're welcome Robin!

    Cheerio,
    vcoolio.

+ 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. Excel "Send to Mail Recipient" Command doesn't work.
    By Dummy99 in forum Excel General
    Replies: 5
    Last Post: 01-19-2016, 03:08 PM
  2. Why IF(VLOOKUP(A1,B:B,1,0)=A1,"1","0") doesn't work properly?
    By regresss in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-30-2015, 06:18 PM
  3. [SOLVED] Rank function using "array IF" formula as ref doesn't seem to work
    By vizzkid in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-11-2014, 09:47 AM
  4. Open files from FTP server (works with "servername" but doesn't work with "ip address")
    By adammsu1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2012, 04:30 PM
  5. "Move and Size with Cell" sometimes doesn't work with VBA created Buttons
    By daveNYC in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2012, 03:27 PM
  6. vba doesn't work with "iferror()" and formula autofill problem
    By lkim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2012, 07:47 AM
  7. Cell Validation "Ingnore Blanks" doesn't work
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2005, 09: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