Excel 2010 - Auto populate cells

Darkbatman

New Member
Joined
Aug 30, 2016
Messages
2
below is sheet No1 & 2:


Sheet+1.jpg



Sheet 2:


Sheet+2.jpg



i would like to Automate excel so that it takes the inspection number from Sheet 1 (yellow cells) and put it in the appropriate location in sheet 2 (Red Cells).






For example: 1st yellow cell in sheet 1 is "Floor paint" in the "Entrance". now it should look for the cell in sheet 2 that falls in the intersection between "Floor paint" Column & "Entrance" row.


How can this be done?


Thanks in advance.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I would use a VBA macro. The question I have is do you want dynamic automation for Sheet1!D by sheet change event, or static automation where all are filled in a single run, or semi-automation using a formula like a custom lookup, or use existing formulas?
 
Last edited:
Upvote 0
I would use a VBA macro. The question I have is do you want dynamic automation for Sheet1!D by sheet change event, or static automation where all are filled in a single run, or semi-automation using a formula like a custom lookup, or use existing formulas?

Unfortunately i'm a very basic user, so i don't really know if i should dynamic and static, but i'll be adding the information manually in sheet 1, and then some magic will be done so that it transfers automatically in the appropriate cell in sheet 2.
 
Upvote 0
Copy this into a Module. Enter the UDF formula as commented into your Sheet2!C3 drag and fill. The Test Sub is just a quick test. It is not needed. And, welcome to the forum!
Code:
Sub test_iMatrix()
  MsgBox iMatrix(Range("Matrix1"), "Floor Paint", "Backyard")
End Sub

'=imatrix(Matrix1,C$2,$B3)
Function iMatrix(rMatrix As Range, sCol1 As String, _
  sCol2 As String, Optional Col1 As Integer = 1, _
  Optional col2 As Integer = 2, Optional col3 As Integer = 3) As Variant
  
  Dim i As Long, r As Range
  
  For i = 1 To rMatrix.Rows.Count
    If rMatrix(i, Col1).Value = sCol1 And rMatrix(i, col2).Value = sCol2 Then Exit For
  Next i
  
  If i > rMatrix.Rows.Count Then Exit Function
  iMatrix = rMatrix(i, col3).Value
End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top