+ Reply to Thread
Results 1 to 2 of 2

Help finding colum with VBA

  1. #1
    Jennifer
    Guest

    Help finding colum with VBA

    I need to be able to determine the column number for the date "1/1/2004" so
    that I can substitute it into a range declaration used for a calculation.

    The data comes to me in the following format:
    Name Month Month Month Month 1/1/2004 Month
    =======================================
    Jeff 50 11 22 31 100 14
    Bob 5 101 122 88 100 14
    Jim 150 11 22 31 100 14

    So the calculation I'm trying to build looks like this:
    z = xlApp.ActiveSheet.UsedRange.Row - 1 +
    xlApp.ActiveSheet.UsedRange.Rows.Count
    Set xlRng2 = xlApp.Range(xlApp.Cells(4, 3), xlApp.Cells(z, 3)) 'Job
    Family Column

    y = xlApp.ActiveSheet.UsedRange.Column - 1 +
    xlApp.ActiveSheet.UsedRange.Columns.Count
    Set xlrng3 = xlApp.Range(xlApp.Cells(4, y), xlApp.Cells(z, y))

    xlApp.Range("j27") =
    xlApp.WorksheetFunction.SumIf(xlApp.Worksheets("Resource
    Info").Range(xlRng2), "QA",
    xlApp.WorksheetFunction.SumIf(xlApp.Worksheets("Resource
    Info").Range(xlRng2).Offset(0, ColRef)))

    Part of the problem here is that the "1/1/2004" COLUMN IS NOT ALWYS IN THE
    SAME place each time I get the report. ANy help is appreciated

  2. #2
    Don Guillett
    Guest

    Re: Help finding colum with VBA

    Sub findcol()
    x = Rows(1).Find("1/1/2004").Column
    MsgBox x
    End Sub

    --
    Don Guillett
    SalesAid Software
    donaldb@281.com
    "Jennifer" <Jennifer@discussions.microsoft.com> wrote in message
    news:4024A5D8-9025-4019-A167-538FF2C8250A@microsoft.com...
    > I need to be able to determine the column number for the date "1/1/2004"

    so
    > that I can substitute it into a range declaration used for a calculation.
    >
    > The data comes to me in the following format:
    > Name Month Month Month Month 1/1/2004 Month
    > =======================================
    > Jeff 50 11 22 31 100 14
    > Bob 5 101 122 88 100 14
    > Jim 150 11 22 31 100 14
    >
    > So the calculation I'm trying to build looks like this:
    > z = xlApp.ActiveSheet.UsedRange.Row - 1 +
    > xlApp.ActiveSheet.UsedRange.Rows.Count
    > Set xlRng2 = xlApp.Range(xlApp.Cells(4, 3), xlApp.Cells(z, 3)) 'Job
    > Family Column
    >
    > y = xlApp.ActiveSheet.UsedRange.Column - 1 +
    > xlApp.ActiveSheet.UsedRange.Columns.Count
    > Set xlrng3 = xlApp.Range(xlApp.Cells(4, y), xlApp.Cells(z, y))
    >
    > xlApp.Range("j27") =
    > xlApp.WorksheetFunction.SumIf(xlApp.Worksheets("Resource
    > Info").Range(xlRng2), "QA",
    > xlApp.WorksheetFunction.SumIf(xlApp.Worksheets("Resource
    > Info").Range(xlRng2).Offset(0, ColRef)))
    >
    > Part of the problem here is that the "1/1/2004" COLUMN IS NOT ALWYS IN THE
    > SAME place each time I get the report. ANy help is appreciated




+ 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