Vlookup code

adamsm

Active Member
Joined
Apr 20, 2010
Messages
444
The following code copies the cell contents from the sheet "Order" to the active sheet depending on the contents of column B written on cell O6 of the active sheet.
Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
      Dim wshI As Worksheet
      Dim rng As Range
      If Not Intersect(Range("O6"), Target) Is Nothing Then
        Set wshI = Worksheets("Order")
        Set rng = wshI.Range("B:B").Find(What:=Range("O6").Value, LookAt:=xlWhole)
        If rng Is Nothing Or Range("O6") = "" Then
          Range("I9:I10,M9:M10,M15,O9:O11").ClearContents
        Else
          Range("I9") = rng.Offset(0, 13)
          Range("I10") = rng.Offset(0, 1)
          Range("M9") = rng.Offset(0, 11)
          Range("M10") = rng.Offset(0, 2)
          Range("M15") = rng.Offset(0, 5)
          Range("O9") = rng.Offset(0, 12)
          Range("O10") = rng.Offset(0, 10)
        End If
      End If
    End Sub
Suppose column B of the sheet contains 123; and the user writes this 123 in cell O6 of the active sheet, the range("I9:I10,M9:M10,M15,O9:O11") gets filled up with appropriate data from the sheet "Order"

My question of concern is how to fill the range ("I11:I15,K15,M12,O12") from sheet "List" as the cell I10 gets filled with data from the sheet "Order" with the above code.

Any help on this would be kindly appreciated.

Thanks in advance.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Sorry missed a part of the question.

My question of concern is how to fill the range ("I11:I15,K15,M12,O12") from sheet "List" as the cell I10 gets filled with data from the sheet "Order" with the above code with data taken from the following ranges.

Code:
Range("I11") = rng.Offset(0, 1)
          Range("I12") = rng.Offset(0, 6)
          Range("I15") = rng.Offset(0, 2)
          Range("K14") = rng.Offset(0, 5)
          Range("M12") = rng.Offset(0, 3)
          Range("O12") = rng.Offset(0, 7)

Any help on this would be kindly appreciated.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

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