Results 1 to 3 of 3
  1. #1
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Using INTERSECT to get cell (VBA/Excel/2002)

    Here I go again. I have to compare a date (that works) and a specific column to find the cell to put an amount into. I think Interesect is working. Not sure of the syntax to drop the value into the derived cell.
    <pre>For G = 2 To Range("A65536").End(xlUp).Row
    Select Case Cells(G, 1)
    Case Is = ITLookUp
    firstRow = Cells(G, 2).Value
    LastRow = Cells(G, 3).Value
    ColNum = Cells(G, 5).Address
    Workbooks(SumFile).Activate
    <font color=red> 'find place for date</font color=red>
    With Sheets(TheMonth).Range(Cells(firstRow, 2), Cells(LastRow, 2))
    For O = firstRow To LastRow
    If Cells(O, 2) = FindDTID Then
    DateCell = Cells(O, 2).Address
    Exit For
    Else
    End If
    Next O
    Set PlopSum = Application.Intersect(Range(DateCell), Range(ColNum))
    <font color=red> 'Yes, the name is stupid
    'XXXXXXX 'Dies on dropping the value in</font color=red>
    PlopSum.Value = TheAmount
    End With
    Case Else
    End Select
    Next G</pre>


    Got any ideas?
    Alan

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Using INTERSECT to get cell (VBA/Excel/2002)

    As far as I can see, ColNum and DateCell are cell adresses for single cells, so if they are equal, the intersection will be that cell, otherwise it will be empty.

  3. #3
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Using INTERSECT to get cell (VBA/Excel/2002)

    <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23> Suddenly I realize that I did not need Intersect -- I have everything I need for the coordinates. <pre>Cells(DateCell, ColNum).Value = TheAmount</pre>

    Alan

Posting Permissions

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