View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Understanding Issues with INTERSECT function in VBA

Hi,

Am Tue, 17 Feb 2015 05:45:31 -0800 (PST) schrieb :

For i = iFirstRow To iLastRow

tbl.Range("A" & iRow & ":M" & iRow).Find(What:=Month(Cells(i, 20)), _
After:=tbl.Range("A" & iRow)).Activate


to find the values and select the range try (modify the ranges for your
table):

Sub Test()
Dim LRow As Long
Dim tbl As Range
Dim myCol As Long
Dim myRow As Long
Dim myCell As Range

With ActiveSheet
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
Set tbl = .Range("A1:M" & LRow)
myCol = WorksheetFunction.Match(Month(.Cells(1, 20)),
..Range("A1:M1"), 0)
myRow = WorksheetFunction.Match(.Cells(1, 21), .Range("A1:A" & LRow), 0)
Set myCell = .Cells(myRow, myCol)
Application.Goto Union(.Rows(myCell.Row), .Columns(myCell.Column))
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional