ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.WorksheetFunction.Index syntax (https://www.excelbanter.com/excel-programming/305909-application-worksheetfunction-index-syntax.html)

LJones[_2_]

Application.WorksheetFunction.Index syntax
 
Novice, self-teaching VB user here...please help!

I am trying to do a simple For/Next Loop with an Index
Statement. I want to insert a text string from a range
names "List" into a cell, move 5 cells to the right,
insert the next name, etc.

I keep getting "Compile Error: Expected =" on the Index
Statement. What am I leaving out??
Thanks,LJ
---------------------

Range("A1").Select
For x = 1 To 3
Application.WorksheetFunction.Index(Range("List"), x,1)
ActiveCell.Offset(0,5).Select
Next x

Vasant Nanavati

Application.WorksheetFunction.Index syntax
 
ActiveCell = Application.WorksheetFunction.Index(Range("List"), x,1)

(although I would avoid all the selecting).

--

Vasant




"LJones" wrote in message
...
Novice, self-teaching VB user here...please help!

I am trying to do a simple For/Next Loop with an Index
Statement. I want to insert a text string from a range
names "List" into a cell, move 5 cells to the right,
insert the next name, etc.

I keep getting "Compile Error: Expected =" on the Index
Statement. What am I leaving out??
Thanks,LJ
---------------------

Range("A1").Select
For x = 1 To 3
Application.WorksheetFunction.Index(Range("List"), x,1)
ActiveCell.Offset(0,5).Select
Next x




keepITcool

Application.WorksheetFunction.Index syntax
 


index is a function. thus is will produce a result.
you dont assign the produced result to a variable..
or a cell.. thus the error :)

change to Activecell.value =Application.Work...

and you s/b fine



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


LJones wrote :

Novice, self-teaching VB user here...please help!

I am trying to do a simple For/Next Loop with an Index
Statement. I want to insert a text string from a range
names "List" into a cell, move 5 cells to the right,
insert the next name, etc.

I keep getting "Compile Error: Expected =" on the Index
Statement. What am I leaving out??
Thanks,LJ
---------------------

Range("A1").Select
For x = 1 To 3
Application.WorksheetFunction.Index(Range("List"), x,1)
ActiveCell.Offset(0,5).Select
Next x



LJones

THANKS
 
Thanks! I feel kind of stupid for forgetting something
so simple.


-----Original Message-----
Novice, self-teaching VB user here...please help!

I am trying to do a simple For/Next Loop with an Index
Statement. I want to insert a text string from a range
names "List" into a cell, move 5 cells to the right,
insert the next name, etc.

I keep getting "Compile Error: Expected =" on the Index
Statement. What am I leaving out??
Thanks,LJ
---------------------

Range("A1").Select
For x = 1 To 3
Application.WorksheetFunction.Index(Range("List"), x,1)
ActiveCell.Offset(0,5).Select
Next x
.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com