+ Reply to Thread
Results 1 to 4 of 4

hi can anyone simplify this old bit of code

  1. #1
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    Unhappy hi can anyone simplify this old bit of code

    ActiveCell.Offset(0, 2).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""RE-WORK"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""NO CALLS"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""SECONDMENT"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""HOLIDAY"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""OBJECTIVE FREE"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""MATERNITY"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""LEFT"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""ILL"",1,0),0))"
    ActiveCell.Offset(0, 1).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""OTHER"",1,0),0))"

    ActiveCell.Offset(0, 6).Range("A1").Select
    Selection.FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C11:R1000C11=""Y"",1,0),0))"

    ActiveCell.Offset(0, 8).Range("A1").Select
    ActiveCell.FormulaR1C1 = "manuCSCBTB1.xls"

    any recommendations, just to let you know this is one small bit of the whole macro/macros. they all create a monitoring sheet.

  2. #2
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    Need to know the absolute cell reference for the cell you started from.

    The first line of code simply says to move 2 columns to the right. But, without knowing what cell you started in, any answer you get might cause some difficulty.

  3. #3
    Forum Contributor
    Join Date
    12-16-2006
    Posts
    349

    re .. script

    b2 select
    scroll down to last used cell
    move down one cell

  4. #4
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    i = ActiveCell.Row

    Cells(i, 4).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""RE-WORK"",1,0),0))"
    Cells(i, 5).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""NO CALLS"",1,0),0))"
    Cells(i, 6).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""SECONDMENT"",1,0),0))"
    Cells(i, 7).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""HOLIDAY"",1,0),0))"
    Cells(i, 8).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""OBJECTIVE FREE"",1,0),0))"
    Cells(i, 9).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""MATERNITY"",1,0),0))"
    Cells(i, 10).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""LEFT"",1,0),0))"
    Cells(i, 11).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""ILL"",1,0),0))"
    Cells(i, 12).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C5:R1000C5=""OTHER"",1,0),0))"

    Cells(i, 18).FormulaArray = _
    "=SUM(IF('[manuCSCBTB1.xls]1'!R2C9:R1000C9=""timothyHINCHEY"",IF('[manuCSCBTB1.xls]1'!R2C11:R1000C11=""Y"",1,0),0))"

    Cells(i, 26).FormulaR1C1 = "manuCSCBTB1.xls"

+ 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