LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 248
Default VB Solution for a INDEX Array Problem

with the assumptions:
both sheet sorted on BU_CD x CY_CD x Cntry_CD
BU_CD x CY_CD x Cntry_CD in the details sheet definitely present in MASTER
(sheet1) try the macro below

Sub Transpose()
Dim lastRow, lastCol As Long
Dim dataSheet As String
Dim dataId, lookupId As String
Dim lookupSheet As String
Dim i, j, k As Long
Application.ScreenUpdating = False
dataSheet = "Sheet2"
lookupSheet = "Sheet1"
Worksheets(dataSheet).Activate
With Worksheets(dataSheet)
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With
dataId = ""
lookupId = ""
j = 2
For i = 2 To lastRow
dataId = Sheets(dataSheet).Cells(i, 1) & Sheets(dataSheet).Cells(i, 2) _
& Sheets(dataSheet).Cells(i, 3)

Do While (dataId < lookupId)
lookupId = Sheets(lookupSheet).Cells(j, 1) & Sheets(lookupSheet).Cells(j, 2) _
& Sheets(lookupSheet).Cells(j, 3)

j = j + 1
Loop
Sheets(dataSheet).Cells(i, 61) = Worksheets(lookupSheet).Cells(j - 1, 4)
Sheets(dataSheet).Cells(i, 62) = Worksheets(lookupSheet).Cells(j - 1, 5)
Sheets(dataSheet).Cells(i, 63) = Worksheets(lookupSheet).Cells(j - 1, 6)
Sheets(dataSheet).Cells(i, 64) = Worksheets(lookupSheet).Cells(j - 1, 7)
Next i
Worksheets(dataSheet).Activate
Application.ScreenUpdating = True
End Sub



--
Pl click the YES button
(if you see it - don''''''''t worry if you don''t),
if this answer was helpful.



"Ananth" wrote:

I have a Master Tab Showing (the table has 1000 records)

BU_CD CY_CD Cntry_CD Att_1 Att_2 Att_3 Att_4
A01 SOC UK XX1 YY1 ZZ1 XY1
A02 SHL NL XX2 YY2 ZZ2 XY2
A03 BPC IR XX3 YY3 ZZ3 XY3
A04 IOC UK XX4 YY4 ZZ4 XY4

I have another tab showing month transactions that has 40000 rows and 60
Columns of information, pulled out from the ERP system. This ERP info has
BU_CD, CY_CD and Country_CD. Using these three combination keys, I have to
populate Column 61 to Column 64 with Attribute_1 to Attribute_4 from the
Master Tab. I want to achieve this with VB as the Index & Match function
(array) takes its own sweet time to complete and sometimes Excel gets
frustrated and returns a message €śNot responding€ť I am not for using
Vlookup as it would require altering table structure.

Any help is appreciated

 
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
Possible Array Solution Needed? [email protected] Excel Discussion (Misc queries) 2 July 7th 08 03:31 PM
Need A Solution To A Problem Dave Excel Discussion (Misc queries) 4 October 3rd 07 04:53 PM
HLOOKUP, VLOOKUP, MATCH, INDEX - Help with the Right Solution! Michael Excel Discussion (Misc queries) 1 March 28th 07 03:40 PM
Index/Match Solution? WeatherGuy Excel Discussion (Misc queries) 3 January 31st 06 10:13 AM
Array index, match problem RAP Excel Worksheet Functions 27 August 21st 05 07:19 PM


All times are GMT +1. The time now is 02:12 AM.

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"