Results 1 to 7 of 7

Thread: Problem with Attachment in Macro

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    VBAX Newbie
    Joined
    Jan 2014
    Posts
    4
    Location

    Post Problem : Compile Error

    Hi everyone,

    Sorry for posting this new problem to this same thread.. I've tried but i couldn't find the button to create a new post..i'm so sorry..


    so.. here's the problem.. I've working on this code where it will update data from current sheet to the next sheet.. and the data that going to be updated must meet either one of these condition (confirm, pending & not now).

    the problem that i've facing is, there's an error in my code which i'm totaly have no idea what does it means..

    the error is " Compile Error: Invalid qualifier"

    and the xlUp(bold) in this line of code been highlighted when the error message showed up.

    For i = 2 To ws1.Range("A20").End(xlUp).Row
    If ws1.Cells(i, 11) = "pending" Then ws1.Rows(i).Copy ws2.Rows(ws2.Cell(ws2.Rows, Count, 11).End(xlUp.Row + 1))
    Next i
    and the line of code came from this function..

    Sub UpdateDataJanuary()
    Dim i As Integer, j As Integer, k As Integer
    Dim ws1 As Worksheet: Set ws1 = ThisWorkbook.Sheets("January")
    Dim ws2 As Worksheet: Set ws2 = ThisWorkbook.Sheets("February")
    For i = 2 To ws1.Range("A20").End(xlUp).Row
    If ws1.Cells(i, 11) = "pending" Then ws1.Rows(i).Copy ws2.Rows(ws2.Cell(ws2.Rows, Count, 11).End(xlUp.Row + 1))
    Next i
    For j = 2 To ws1.Range("A20").End(xlUp).Row
    If ws1.Cells(j, 11) = "extend" Then ws1.Rows(j).Copy ws2.Rows(ws2.Cells(ws2.Rows, Count, 11).End(xlUp.Row + 1))
    Next j
    For k = 2 To ws1.Range("A20").End(xlUp).Row
    If ws1.Cells(k, 11) = "Not Confirm" Then ws1.Rows(i).Copy ws2.Rows(ws2.Cells(ws2.Rows, Count, 11).End(xlUp.Row + 1))
    Next k
    End Sub

    can any of you help me to solve this problem? pleasee..
    Last edited by Bob Phillips; 03-12-2014 at 02:55 AM. Reason: Added VBA tags

Posting Permissions

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