+ Reply to Thread
Results 1 to 3 of 3

Run time error: Type mismatch

  1. #1
    Registered User
    Join Date
    08-04-2008
    Location
    South Africa
    Posts
    4

    Run time error: Type mismatch

    Hi, I created a toolbar with an 'Update' button on it. The update button takes values from sheet 1, does calculations and puts it in sheet two. Here is my code:

    Please Login or Register  to view this content.
    The run time error occurs at the line: cell1 = cellChange.Text

    If I take out the line: Worksheets("Sheet1").Activate, I don't get the error anymore but then it doesn't update the sheet from sheet one, only from sheet two, doesn't matter what I do.

    The other thing that I also noticed is that the error also only occur when a fraction value is encountered at sheet 1. With normal integer values, it works fine.

    Please help me to understand what the problem is!
    Last edited by VBA Noob; 08-04-2008 at 08:00 AM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    I suspect it is down to your declaration of cell1 being a Double but then you accessing the text property of the cell (and Excel/VBA failing to convert whatever value to a numeric state).

    Why don't you simply access the Value property of the cell rather than the Text property?

    Please Login or Register  to view this content.
    Richard

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Select is seldom needed. Try:
    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)

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