LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default VBA code for INDEX MATCH Functions

Can anyone help me here ... I haver a worksheet with 10000+ rows and I have
used the vba below to pick up a unique reference, however it relys on
ActiveCell.FormulaArray = operation that updates a total of 6 cells before
concatenating them by means of a simple cell formula = 60000+ events

My question is how do I better code this into VBA to simply supply the end
concatenated result, I am struggling to find any alternative

Many Thanks In advance
--
Alan

MYCODE

no1 = "$k$" & CurrentRow
No2 = "$j$" & CurrentRow
NO3 = "$i$" & CurrentRow
NO4 = "$h$" & CurrentRow
NO5 = "$g$" & CurrentRow
NO6 = "$L$" & CurrentRow

Dim indexarray1 As String
'stationname
indexarray1 = "=INDEX(Station!B:E,MATCH(" & NO3 & "&" & NO4 & "&" & NO5 &
",Station!$B$1:$B$3000&Station!$C$1:$C$3000&Statio n!$D$1:$D$3000,0),4)"
ActiveCell.FormulaArray = indexarray1
If ActiveCell.Text = "#N/A" Then ActiveCell.Value = "'0000"
ActiveCell = ActiveCell.Offset(0, 1).Activate
'subdivdeptname
indexarray1 = "=INDEX(Subdivision!B:D,MATCH(" & NO4 & "&" & NO5 &
",Subdivision!$B$1:$B$3000&Subdivision!$C$1:$C$300 0,0),3)"
ActiveCell.FormulaArray = indexarray1
If ActiveCell.Text = "#N/A" Then ActiveCell.Value = "'0000"
ActiveCell = ActiveCell.Offset(0, 1).Activate
'substationname
indexarray1 = "=INDEX(Substation!B:F,MATCH(" & No2 & "&" & NO3 & "&" & NO4 &
"&" & NO5 &
",Substation!$B$1:$B$3000&Substation!$C$1:$C$3000& Substation!$D$1:$D$3000&Substation!$E$1:$E$3000,0) ,5)"
ActiveCell.FormulaArray = indexarray1
If ActiveCell.Text = "#N/A" Then ActiveCell.Value = "'0000"
ActiveCell = ActiveCell.Offset(0, 1).Activate
'depatrmentname
indexarray1 = "=INDEX(Dept!B:G,MATCH(" & no1 & "&" & No2 & "&" & NO3 & "&" &
NO4 & "&" & NO5 &
",Dept!$B$1:$B$3000&Dept!$C$1:$C$3000&Dept!$D$1:$D $3000&Dept!$E$1:$E$3000&Dept!$F$1:$F$3000,0),6)"
ActiveCell.FormulaArray = indexarray1
If ActiveCell.Text = "#N/A" Then ActiveCell.Value = "'0000"
ActiveCell = ActiveCell.Offset(0, 1).Activate
'sectionname
indexarray1 = "=INDEX(Section!B:E,MATCH(" & NO6 & "&" & NO4 & "&" & NO5 &
",Section!$B$1:$B$30&Section!$C$1:$C$30&Section!$D $1:$D$30,0),4)"
ActiveCell.FormulaArray = indexarray1

 
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 MATCH functions dannyboy8 Excel Worksheet Functions 2 November 25th 08 08:12 PM
Index and Match functions I think Jim Butler New Users to Excel 9 November 25th 08 02:34 AM
Row, Index, Match functions Christopher Naveen[_2_] Excel Discussion (Misc queries) 1 September 20th 07 08:42 AM
Index and Match Functions amirstal Excel Programming 1 December 7th 06 04:43 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 11:50 PM.

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

About Us

"It's about Microsoft Excel"