+ Reply to Thread
Results 1 to 5 of 5

invalid qualifier error

Hybrid View

Maglor invalid qualifier error 09-30-2009, 07:39 AM
romperstomper Re: invalid qualifier error 09-30-2009, 07:45 AM
Maglor Re: invalid qualifier error 09-30-2009, 09:03 AM
romperstomper Re: invalid qualifier error 09-30-2009, 09:06 AM
Maglor Re: invalid qualifier error 09-30-2009, 09:14 AM
  1. #1
    Registered User
    Join Date
    09-22-2009
    Location
    Hobart, Australia
    MS-Off Ver
    Excel 2007
    Posts
    16

    Question invalid qualifier error

    i keep getting errors when im trying to run this bit of code

    Private Sub signout_Click()
    Dim ws, ws2, ws3, ws4 As Worksheet
    Dim iRow, iRow2, iRow3 As Long
    Dim myRng2 As Range
    Dim staffin, staffout As String
    Set ws = Workbooks("payslips").Worksheets("Employee Details")
    Set ws2 = Workbooks("payslips").Worksheets("Sign In-Out")
    Set ws3 = Workbooks("payslips").Worksheets("Weekly")
    Set ws4 = Workbooks("payslips").Worksheets("Record of all Sign In-Out")
    
    iRow = Cells.Find(what:=Me.staffout, After:=ws2.Range("B2"), LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Row
            
    ws2.Cells(iRow, 5).Value = Time
    
    
    iRow2 = Cells.Find(what:=ws2.Cells(iRow, 1).Value, After:=ws3.Range("A2"), LookIn:=xlFormulas, LookAt _
            :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
            False, SearchFormat:=False).Row
    
    ws3.Cells(iRow2, 5).Value = ws3.Cells(iRow2, 5).Value + ws2.Cells(iRow, 6).Value
    
    
        'finds first empty row in database
        iRow3 = ws4.Cells(Rows.Count, 1) _
        .End(xlUp).Offset(1, 0).Row
    
     ' the current error is iRow3 is an invalid qualifier on the below line
    ws2.Range(iRow.Row).Cut Destination:=ws4.Range(iRow3.Row)
    
    
    End Sub
    I'm not even sure if this is the best way to do it. Any tips or ideas would be greatly appreciated

    Regards Mag
    Last edited by Maglor; 09-30-2009 at 09:15 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: invalid qualifier error

    If iRow and iRow3 are supposed to be Long integers, then they don't have any properties, so you can't use iRow.Row as it makes no sense.
    You should also be aware that if you write this:
    Dim iRow, iRow2, iRow3 As Long
    you have actually only declared iRow3 as a Long - the others are all Variants. You need to specify a type for each:
    Dim iRow As Long, iRow2 As Long, iRow3 As Long
    and similarly for your worksheet variables.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    09-22-2009
    Location
    Hobart, Australia
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: invalid qualifier error

    Thanks for your reply,

    i didnt realise in typing it that way i was only defining the last variable as the type. seems a bit strange because i picked that up after seeing it in several different places as examples. But as that is the case i will make all the necessary adjustments in that regard.

    I realise what you are saying makes sense to you but unfortunately not to me. I am trying to tell it to cut the row that is what iRow equals and paste/insert it to where iRow3 is in the other worksheet.

    in my VERY limited knowledge of VBA coding i thought that the bit in () was basically saying in ws4 row 2 insert the row. where the 2 is determined by the value of iRow3.

    ws4.Range(iRow3.Row)
    as you are saying that is obviously wrong could you please provide the correct syntax for what im trying to achieve.

    Thanks again
    Regards
    Mag

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,973

    Re: invalid qualifier error

    Sure - you need:
    ws2.Rows(iRow).Cut Destination:=ws4.Rows(iRow3)

  5. #5
    Registered User
    Join Date
    09-22-2009
    Location
    Hobart, Australia
    MS-Off Ver
    Excel 2007
    Posts
    16

    Re: invalid qualifier error

    Thats brilliant, worked a treat, thank you once again.

+ 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