+ Reply to Thread
Results 1 to 6 of 6

show last cell value in message box

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    96

    show last cell value in message box

    whats wrong with this code at msgbox line, it show error .The code is placed in command_click button

    Please Login or Register  to view this content.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: show last cell value in message box

    Hi, mubashar,

    maybe just use
    Please Login or Register  to view this content.
    You canīt assign the values of a range to a string like you tried to do, you would need a loop for that.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor gsnidow's Avatar
    Join Date
    07-22-2010
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2007
    Posts
    150

    Re: show last cell value in message box

    mubashar, you are trying to set a variable, 'maritvalue', equal to the value of a range. This would essentially make its existence redundant, even if you could do it. Secondly, MsgBox displays string variables, not objects. If you only want to see the value of the last cell in the range, you could incorporate something like this in your code.

    Please Login or Register  to view this content.
    Greg
    Just a guy trying to make work stuff easier.

  4. #4
    Registered User
    Join Date
    04-11-2012
    Location
    Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    96

    Re: show last cell value in message box

    thanks to both of you, with your help it has been solved

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: show last cell value in message box

    To add onto what Hahobe said the loop would be something like this:

    Please Login or Register  to view this content.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: show last cell value in message box

    Hi, mubashar,

    do you mind to mark this thread as Solved via Thread Tools?

    Ciao,
    Holger

+ 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. Macro to show a message box if even one cell in a row is blank
    By patsdavixen in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-02-2013, 12:09 PM
  2. Message box to show cell value from a different (closed) WorkBook
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-19-2011, 08:58 AM
  3. Excel 2007 : Making a cell blank or show message
    By Northsea Medic in forum Excel General
    Replies: 3
    Last Post: 03-22-2009, 04:13 PM
  4. Show Message Box When Cell Is Filled In
    By SamuelT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2008, 11:50 AM
  5. Run the Macro if cell value is YES, else show error message.
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2008, 02:03 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