Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
What does this parameter mean?
My macro appears as follows
Dim r As Range, c As Range Set r = Range(Range("B4"), Range("B4").End(xlDown)) Set c = r.Find("NA", SearchDirection:=xlPrevious)(2) If Not c Is Nothing Then Set r = Range(c, c.End(xlDown)) Range("D4").Resize(r.Count).Value = r.Value End If My question is based on the following line Set c = r.Find("NA", SearchDirection:=xlPrevious)(2) What does the (2) at the end of the line mean? Thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
What does this parameter mean?
Hi ManKind,
My question is based on the following line Set c = r.Find("NA", SearchDirection:=xlPrevious)(2) What does the (2) at the end of the line mean? This line of code is an abbreviation for: Set c = r.Find("NA", SearchDirection:=xlPrevious).Item(2,1) and is equivalent to: Set c = r.Find("NA", SearchDirection:=xlPrevious).Offset(1,0) For a detailed discussion of this, Chip Pearson hosts an excellent article, written by Alan Beban: http://www.cpearson.com/excel/cells.htm --- Regards, Norman "ManKind" wrote in message ... My macro appears as follows Dim r As Range, c As Range Set r = Range(Range("B4"), Range("B4").End(xlDown)) Set c = r.Find("NA", SearchDirection:=xlPrevious)(2) If Not c Is Nothing Then Set r = Range(c, c.End(xlDown)) Range("D4").Resize(r.Count).Value = r.Value End If My question is based on the following line Set c = r.Find("NA", SearchDirection:=xlPrevious)(2) What does the (2) at the end of the line mean? Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I use a cell value as a parameter | Excel Worksheet Functions | |||
How to choose if I use a parameter or not in a parameter query | Excel Discussion (Misc queries) | |||
Collection as parameter | Excel Programming | |||
Parameter query | Excel Programming | |||
parameter value query | Excel Programming |