Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use a cell value as a parameter Richhall[_2_] Excel Worksheet Functions 5 January 6th 08 05:02 PM
How to choose if I use a parameter or not in a parameter query Arnaud Excel Discussion (Misc queries) 0 March 8th 07 01:19 PM
Collection as parameter stefantem[_15_] Excel Programming 2 January 13th 06 01:01 PM
Parameter query mtate Excel Programming 2 April 20th 05 09:02 PM
parameter value query Brad Vontur[_2_] Excel Programming 0 April 6th 04 04:46 PM


All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"