Looking at matching values in 2 sheets and using data from offset column to populate cells.

Mike Neal

New Member
Joined
May 24, 2020
Messages
38
Office Version
  1. 2013
Platform
  1. Windows
I have 2 sheets that each have a column for Task IDs. The first sheet is called PM Tasks and in column "A" I have Task IDs and in column "B" I have the frequency of the tasks to be performed. This is: "Weekly", "Monthly", etc. The second sheet is called "PM Schedule" on this sheet the Task IDs are in column "B". On the first sheet the Task ID is only listed once. It is my Master List of Tasks. The second sheet the Task ID's repeat because they are assigned to Machine IDs and one Task can be assigned to more than one machine. I am trying to lookup the Task ID on the first sheet and find the Frequency which is in Column B and add that Frequency to every occurrence of that Task in the second sheet in Column C. This is what I have so far but I get an error 438 "Object doesn't support this property or method."
In the line: Dic (Cl.value = Cl.Offset(, 1).value)

I would appreciate and help with this. Thank you.

Dim Cl As Range, Dic As Object

Set Dic = CreateObject("Scripting.dictionary")

With Sheets("PM Tasks")

For Each Cl In .Range("A3", .Range("A" & Rows.Count).End(xlUp))

Dic (Cl.value = Cl.Offset(, 1).value)

Next Cl

End With

With Sheets("PM Schedule")

For Each Cl In .Range("B3", .Range("B" & Rows.Count).End(xlUp))

If Dic.Exists(Cl.value) Then Cl.Offset(, 1).value = Dic(Cl.value)

Next Cl

End With
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,468
Office Version
  1. 365
Platform
  1. Windows
It should be
VBA Code:
 Dic(Cl.value) = Cl.Offset(, 1).value
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,468
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,378
Messages
5,635,911
Members
416,887
Latest member
SheriE

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
Top