Matching Worksheets

Darren Smith

Well-known Member
Joined
Nov 23, 2020
Messages
631
Office Version
  1. 2019
Platform
  1. Windows
Hi all

Trying to match worksheets see below. Can`t make it work??

VBA Code:
If ListBox4 = "Fills Job Card Master Sheet into Time Analysis Sheet" Then

   Dim Ary As Variant, Nary As Variant
   Dim wsDest As Worksheet
   Set wsDest = Worksheets("Job Card with Time Analysis")
   Dim rng As Range
   Set rng = wsDest.Range("A10:N")
   Dim Dic As Object
   Dim l As Long
  
   Set Dic = CreateObject("scripting.dictionary")

   With Sheets("Job Card Master")
   
      Ary = .Range("A10", .Range("A" & Rows.Count).End(xlUp)).Value2
      Nary = .Range("A10:N" & .Range("A" & Rows.Count).End(xlUp).Row).Value2
   End With
  
   With Sheets("Job Card with Time Analysis")
   
      For Each rng In .Range("A10", .Range("A" & Rows.Count).End(xlUp))
         Dic(rng.Value) = Empty
      Next rng
   End With
   For l = 1 To UBound(Ary)
      If Dic.Exists(Ary(r, 1)) Then Nary(r, 1) = "Yes"
   Next l
   Sheets("Job Card Master").Range("A10").Resize(UBound(Nary)).Value = Nary
   
   End If
   
End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Rather than posting code that doesn't work, with no explanation of what's wrong. You would be better off explaining what you are trying to do.
 
Upvote 0
I am trying to match the data from the worksheet to the new worksheet (In the same workbook) from Range A10 to N down to the bottom of the worksheets.
Trust that makes sense?
 
Upvote 0
Trust that makes sense?
No, fraid not.
Do you need to compare every cell, or just one column?
What do you want to do if they match & what do you want to do if they don't?

Please remember that whilst you have an intimate knowledge of your data & what you want to do, we do not.
You need to give clear & precise details.
 
Upvote 0
No, fraid not.
Do you need to compare every cell, or just one column? All cells in the range A10 to N to bottom of worksheet
What do you want to do if they match & what do you want to do if they don't? All cells in the range need to match so what you write in Job Card Master Sheet fills the Job Card with Time Analysis Sheet in
automatically


Please remember that whilst you have an intimate knowledge of your data & what you want to do, we do not.
You need to give clear & precise details. Ok sorry
Is that any better see above
 
Upvote 0
No fraid not.
You have not said what should happen if they match & what should happen if they don't.
 
Upvote 0
Do NOT put your replies inside the quote, it looks as though you have not replied.
Did you actually read & understand this?
Please remember that whilst you have an intimate knowledge of your data & what you want to do, we do not.
You need to give clear & precise details.
I ask because you have so far totally ignored it. I cannot help you if you do not help me.
 
Upvote 0
I assure you I am not ignoring you.
I was trying to say that if cells in the range match then they are to stay. If they are different then leave cells blank
 
Upvote 0
What do you mean leave them blank? Do you clear them? If so in which sheet?
You have so far given very very general answers when I have asked you to be specific.
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

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