Results 1 to 9 of 9

Type mismatch error obtaining value from a cell

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2011
    Location
    Kent, England
    MS-Off Ver
    Excel 2010
    Posts
    32

    Type mismatch error obtaining value from a cell

    Hi there,

    This is probably quite simple, but I haven't found the answer on the forum or elsewhere... please help

    Dim ProjectNumber As Long
    Dim TableRow As Integer
    TableRow = 6
    
    Do While Not IsEmpty(Workbooks(BacklogWorkbook).Sheets("Backlog Data").Range("a" & TableRow))
    
        ProjectNumber = Workbooks(BacklogWorkbook).Sheets("Backlog Data").Range("d" & TableRow)
    
    ' rest of the Do While loop follows
    So the idea is that it is going through a set of data one row at a time (using TableRow), and the first task is to extract the ProjectNumber from column d of the row.

    The final line of my code (ProjectNumber = etc) gives me a type mismatch error when I run it.
    The same result occurs with:

    Dim ProjectNumber as Integer
    On the other hand, if I do this:

    Dim ProjectNumber as Range
    I get this error instead:
    Object variable or With block variable not set

    ...which makes no sense to me as ProjectNumber is not an object (unless Range is an object of course, but in that case surely I have set it?)

    Confused!!

    Any help appreciated... thanks

    ssu95bm
    Last edited by ssu95bm; 03-09-2015 at 09:58 AM. Reason: SOLVED

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Run-time error '13': Type mismatch - How to work with Cell.value
    By beutlerm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2014, 01:18 PM
  2. putting an if condition based on text in a cell - runtime error 13: type mismatch
    By rbs123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2013, 04:02 AM
  3. [SOLVED] Display cell reference - runtime error type mismatch
    By Brumbot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 06:44 AM
  4. Type Mismatch Error when deleting a cell
    By Josiah in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2008, 01:07 PM
  5. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM

Tags for this Thread

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