Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default selecting a cell based on lookup with VBA

Hi!

I have the following problem: Sheet 1 is a matrix of which the two axes
describe two variables. Sheet 2 contains values of variable 1 in column A and
values of Variable 2 in column B. Based on the pair of these values in column
A and B, I want to look up for each row the corresponding value from the
matrix (based on the values of variable 1 and 2). How can this be solved
using VBA?

Thanx for your suggestions!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default selecting a cell based on lookup with VBA


Problem is solved using the following code:

Sub LookupDirectLabour()
Dim ActiveCell As Range
Dim Cell As Range


For DirectLabourRow = 2 To Cells(Rows.Count, 1).End(xlUp).Offset(1,
0).Row

Set DirectLabourCellWC = Worksheets("Direct Labour").Cells
_(DirectLabourRow, 1)
Set DirectLabourCellAcc = Worksheets("Direct Labour").Cells
_(DirectLabourRow, 2)


With DirectLabourCellWC

For colIndex = 5 To 27
With Worksheets("COOMonthWC").Cells(7, colIndex)
If .Value = DirectLabourCellWC.Value Then
With DirectLabourCellAcc
For rwIndex = 10 To 91
With
Worksheets("COOMonthWC").Cells(rwIndex, 1)
If .Value =
DirectLabourCellAcc.Value Then
DirectLabourCellWC.Offset(0,
3).Value = _ Worksheets("COOMonthWC").Cells(rwIndex, colIndex) *
(DirectLabourCellWC.Offset(0, 2) / 100)
End If
End With
Next rwIndex
End With
End If
End With
Next colIndex

End With
Next

End Sub

"PhilipsBernard" wrote:

Hi!

I have the following problem: Sheet 1 is a matrix of which the two axes
describe two variables. Sheet 2 contains values of variable 1 in column A and
values of Variable 2 in column B. Based on the pair of these values in column
A and B, I want to look up for each row the corresponding value from the
matrix (based on the values of variable 1 and 2). How can this be solved
using VBA?

Thanx for your suggestions!

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
Selecting a cell entry based on cell validation selection Brutalius Excel Worksheet Functions 2 December 17th 08 03:44 AM
Selecting A Column based on Cell Value newguy Excel Discussion (Misc queries) 0 December 14th 06 09:39 PM
Selecting Sheets based on Cell Criteria. Tim Richards Excel Programming 3 May 25th 05 12:28 AM
Selecting a sheet based on a cell wilcster Excel Programming 3 December 30th 04 05:05 PM
selecting and deleting a row based on a cell value JJ Excel Programming 4 December 1st 04 05:59 PM


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