Results 1 to 3 of 3

Thread: [RESOLVED] visual basic script

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2013
    Posts
    16

    Resolved [RESOLVED] visual basic script

    Hi, can somone help me? I have script and i dont know what is wrong:

    Function LastRow()
    Dim c As Object
    With Sheets(1).Range("A:A")
    Set c = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByRows, searchdirection:=xlPrevious)
    End With
    LastRow = (c.Row)
    End Function

    Function inserthgbstelement(title, status, rank)
    Dim funObjid As Long
    objName = "hgbst_elm"
    funObjid = getNextObjid(objName)

    conn.Execute "insert into table_hgbst_elm(objid, TITLE, S_TITLE, RANK, STATE, DEV, INTVAL) values (funObjid, title, Upper(title), rank, status, "",0)"
    inserthgbstelement = funObjid
    End Function


    Sub Przeszukanie_po_wierszu()

    Dim c As Object
    Dim x As Integer


    With Sheets(1).Range("A:A")
    Set c = .Find(What:="*", LookIn:=xlValues, Lookat:=xlPart, searchorder:=xlByColumns, searchdirection:=xlPrevious)
    For x = 3 To LastRow
    y = inserthgbstelement(Sheets(1).Range("A" + x), Sheets(1).Range("B" + x), x - 3)
    Next x
    End With
    End Sub



    Error: 13 type mismatch
    if i click on debyg show me line y = inserthgbstelement(Sheets(1).Range("A" + x), Sheets(1).Range("B" + x), x - 3)

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: visual basic script

    Concatenate strings using the & operator, not the + operator:

    Code:
    y = inserthgbstelement(Sheets(1).Range("A" & x), Sheets(1).Range("B" & x), x - 3)
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2013
    Posts
    16

    Re: visual basic script

    thank you. I change this

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