+ Reply to Thread
Results 1 to 1 of 1

Find Last row and fill the cells

  1. #1
    Registered User
    Join Date
    04-07-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Find Last row and fill the cells

    Hi,

    I need to find the last used row in excel and fill the next row as per conditons.

    The conditions are prepared, but please help me in code to find the last used and implement the conditions from the next cell.

    I am also attaching the sheet.


    here is piece of conditions which should be filled every time when last row is found.

    Myfile = "C:\Documents and Settings\sw47604\Desktop\dq\FW-22\Block10n11.xls"
    Set objWB = objExcel.Workbooks.Open(Myfile)

    Selection.AutoFilter Field:=13, Criteria1:="=*3300*", Operator:=xlAnd
    Selection.AutoFilter Field:=12, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 11) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=13, Criteria1:="=*3500*", Operator:=xlAnd
    Selection.AutoFilter Field:=12, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 12) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=13, Criteria1:="MKVI"
    Selection.AutoFilter Field:=12, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 13) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=13, Criteria1:="="
    Selection.AutoFilter Field:=12, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 14) = WorksheetFunction.Subtotal(3, Range("A2:A700"))


    Myfile = "C:\Documents and Settings\sw47604\Desktop\dq\FW-22\Block6n7.xls"
    Set objWB = objExcel.Workbooks.Open(Myfile)

    Selection.AutoFilter Field:=6, Criteria1:="=*3300*", Operator:=xlAnd
    Selection.AutoFilter Field:=5, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 16) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=6, Criteria1:="=*3500*", Operator:=xlAnd
    Selection.AutoFilter Field:=5, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 17) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=6, Criteria1:="MKVI", Operator:=xlAnd
    Selection.AutoFilter Field:=5, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 18) = WorksheetFunction.Subtotal(3, Range("A2:A700"))

    Selection.AutoFilter Field:=6, Criteria1:="=", Operator:=xlAnd
    Selection.AutoFilter Field:=5, Criteria1:=">50", Operator:=xlAnd
    objWS.Cells(3, 19) = WorksheetFunction.Subtotal(3, Range("A2:A700"))


    'Percentage Calculation

    objWS.Cells(3, 4) = "=K3/P3*100"
    objWS.Cells(3, 5) = "=L3/Q3*100"
    objWS.Cells(3, 6) = "=M3/R3*100"
    objWS.Cells(3, 7) = "=N3/S3*100"

    Thanks in advance.
    Attached Files Attached Files

+ 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