Results 1 to 3 of 3

applying a formula to single column in an array

Threaded View

  1. #1
    Registered User
    Join Date
    05-25-2010
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    3

    applying a formula to single column in an array

    Hi
    I currently have some code which is selecting 5 cells from a row where one of those cells is a specific number, and copying that data to a new sheet. The source file and cells contain some billing information and the output destination file is an invoice. My source file contains information for many customers, so my copy selection code copies data for each individual customer to a new sheet so I get an invoice for each customer. Here is my current code:

    Set SrcRng = Workbooks("SOURCE DATA.XLS").Worksheets("Specific Data").UsedRange
    Set DstRng = Workbooks("INVOICES.xls").Worksheets("Customer #2").Range("A10")
    
        KeepColumns = Array("A", "B", "C", "E", "D")
        MatchColumn = "C"
        MatchValue = 2
    
          For Each Cell In SrcRng.Columns(MatchColumn).Cells
            If Cell.Value = MatchValue Then
               R = Cell.Row
               C = 0
               For Each Col In KeepColumns
                 DstRng.Offset(N, C) = SrcRng.Cells(R, Col)
                 C = C + 1
               Next Col
               N = N + 1
            End If
          Next Cell
    Column E in my source data contains my employees hours. When I bill my customers and invoice them I bill 1.5 hours of travel time separately, so I need to deduct that time from my employees hours on the invoice.
    Basically I need to subtract 1.5 from each cell in column E when it pastes to the new inovice workbook.

    How can I accomplish this?


    Any and all help is much appreciated.
    Thanks!!!!
    Last edited by shevy; 06-11-2010 at 12:28 PM.

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