Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default INDEX functions problem

Hello,

I'm trying to use the INDEX fonction in vba and I keeping getting errors.
Here's an example :

Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)

or

Worksheets("Sheet1").Range("F2").Formula = "INDEX(A1:E20;4;4)

When running one of these codes, I get this error :

Run-time error 1004
Application-defined or object-defined error


What should I do to make it work ?

thanks in advance.

Nader


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default INDEX functions problem

Hi Nader,

Use

Worksheets("Sheet1").Range("F2").FormulaLocal = "INDEX(A1:E20;4;4)

Or use commas instead of semicolons, then you can use .Formula

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"Nader" wrote in message ...
| Hello,
|
| I'm trying to use the INDEX fonction in vba and I keeping getting errors.
| Here's an example :
|
| Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)
|
| or
|
| Worksheets("Sheet1").Range("F2").Formula = "INDEX(A1:E20;4;4)
|
| When running one of these codes, I get this error :
|
| Run-time error 1004
| Application-defined or object-defined error
|
|
| What should I do to make it work ?
|
| thanks in advance.
|
| Nader
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default INDEX functions problem

And of course add a " to the end of the statement

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Niek Otten" wrote in message ...
| Hi Nader,
|
| Use
|
| Worksheets("Sheet1").Range("F2").FormulaLocal = "INDEX(A1:E20;4;4)
|
| Or use commas instead of semicolons, then you can use .Formula
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
|
| "Nader" wrote in message ...
|| Hello,
||
|| I'm trying to use the INDEX fonction in vba and I keeping getting errors.
|| Here's an example :
||
|| Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)
||
|| or
||
|| Worksheets("Sheet1").Range("F2").Formula = "INDEX(A1:E20;4;4)
||
|| When running one of these codes, I get this error :
||
|| Run-time error 1004
|| Application-defined or object-defined error
||
||
|| What should I do to make it work ?
||
|| thanks in advance.
||
|| Nader
||
||
|
|


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default INDEX functions problem

depends on whether you want to do the index in vba and return the answer or
put the formula in a cell

to return the value:
with Worksheets("Sheet1")
.Range("F2").Value = Application.INDEX(Range("A1:E20"),4,4)
End with

to put in a formula
Worksheets("Sheet1").Range("F2").Formula = "=INDEX(A1:E20,4,4)"

when you use formula, you need to put the formula in the same format as US
English.

You also have the option of FormulaLocal, but that is less transportable.

--
Rgards,
Tom Ogilvy



"Nader" wrote:

Hello,

I'm trying to use the INDEX fonction in vba and I keeping getting errors.
Here's an example :

Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)

or

Worksheets("Sheet1").Range("F2").Formula = "INDEX(A1:E20;4;4)

When running one of these codes, I get this error :

Run-time error 1004
Application-defined or object-defined error


What should I do to make it work ?

thanks in advance.

Nader



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default INDEX functions problem


Replace the semi colon in your formula with a comma.

Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20*-,-*-4;4)"

Nader Wrote:
Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)"



--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=566629



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default INDEX functions problem


Replace the semi colons in your formula with commas.

Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20*-,-*-4*-;-*-4)"

Nader Wrote:
Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)"



--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=566629

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default INDEX functions problem


Replace the semi colons in your formula with commas and place an equals
sign inside the quotes.

Worksheets("Sheet1").Range("F2").Value =
"*-=-*-INDEX(A1:E20*-,-*-4*-,-*-4)"

Nader Wrote:
Worksheets("Sheet1").Range("F2").Value = "INDEX(A1:E20;4;4)"



--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=566629

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
INDEX AND MATCHING FUNCTIONS Jeanette Excel Worksheet Functions 5 September 21st 09 09:23 PM
IF and INDEX functions...I'm lost... Kim Nacrelli Excel Discussion (Misc queries) 2 October 27th 08 02:15 PM
Row, Index, Match functions Christopher Naveen[_2_] Excel Discussion (Misc queries) 1 September 20th 07 08:42 AM
Index and Match Functions Damien Excel Worksheet Functions 4 July 29th 06 10:12 PM
How do I use the Match and Index functions to look up a value tha. Maclanders Excel Worksheet Functions 7 February 10th 05 08:31 PM


All times are GMT +1. The time now is 04:24 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"