Results 1 to 3 of 3

Thread: Visual Basic in Excel, Mismatch Error

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    124

    Visual Basic in Excel, Mismatch Error

    ++Hope this is the right forum++

    Now Visual Basic In excel is very odd. Its not too hard to get your head around it its just odd when reading and writting Information.

    I'm gettnig a Mismatch error when I try to read to read a number form the speardsheet and laod it as a viriable.

    Heres the code thats giveing me the error

    VB Code:
    1. 'Part of the AddRecord() Sub
    2.     Dim RecordNumber As Long
    3.     Dim index As Integer
    4.     Dim DoB As String
    5.     Dim Num As Long
    6.     index = 0
    7.     Sheets("Data").Select
    8.     [b]RecordNumber = Range("B2").Value 'This line is giving me the error[/b]
    9.     Sheets("Enter Data").Select
    10.     Num = Range("G11:I11").Value
    11.     If Num = RecordNumber Then
    12.         Else
    13.         MsgBox ("You changed the Record Number, this Record has NOT be processed")
    14.         Sheets("Data Main").Select
    15.         Exit Sub
    16.     End If

    Can anyone help me with this? I can't think of a reason for it not to work. I've uplaoded the workbook if anyone wants to check in that.

    Cheers
    --ichar
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width