Macro for check cells

LoganTrk

New Member
Joined
Jan 24, 2019
Messages
17
I have been trying the following and I can not do it

In sheet “OP” you must go through the codes reported in the field "Work Code", checking that the same code has been incorporated in the field "Work Code" of sheet “AP”. In case any code is not found in the sheet “AP”, the macro should check if it is in the "Related Work Code" field on sheet “AS”. If it is not found on this sheet either, it should show the code in page “Result”



Sheet “OP”

[TABLE="width: 240"]
<tbody>[TR]
[TD]System
[/TD]
[TD]System2
[/TD]
[TD]Work Code
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]15-8
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]1213
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]1
[/TD]
[/TR]
</tbody>[/TABLE]

Sheet “AP”



[TABLE="width: 341"]
<tbody>[TR]
[TD]Recent
[/TD]
[TD]Work type
[/TD]
[TD]Type code
[/TD]
[TD]Work Code
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]1213
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]




Sheet “AS”

[TABLE="width: 646"]
<tbody>[TR]
[TD]System
[/TD]
[TD]local
[/TD]
[TD]x
[/TD]
[TD]City
[/TD]
[TD]Code ccity
[/TD]
[TD]Tyoer Related code
[/TD]
[TD]Tyoer Related code
[/TD]
[TD]Related Work Code
[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]15
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Expect result codes : 15-8 , 1

My code don’t work ;/

Regards
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
My code is below please help

Code:
Application.ScreenUpdating = False
Dim varrayC As Variant, varrayA As Variant, varrayB As Variant, varrayD As Variant
Dim dict As Object
Dim dictdos As Object
Dim j As Double
Dim k As Double


Set dict = CreateObject("scripting.dictionary")
Set dictdos = CreateObject("scripting.dictionary")




lastRow = Sheet15.Range("D" & Rows.Count).End(xlUp).Row
varrayA = Sheet15.Range("D1:D" & lastRow).value


lastRow = Sheet4.Range("C" & Rows.Count).End(xlUp).Row
varrayC = Sheet4.Range("C2:C" & lastRow).value


lastRow = Sheet6.Range("AG" & Rows.Count).End(xlUp).Row
varrayB = Sheet6.Range("AG2:AG" & lastRow).value


lastRow = Sheet16.Range("H" & Rows.Count).End(xlUp).Row
varrayD = Sheet16.Range("H2:H" & lastRow).value


On Error Resume Next
For i = 1 To UBound(varrayA, 1)
    dict.Add varrayA(i, 1), 1
Next


j = 1
k = 7




For i = 1 To UBound(varrayC, 1)


    If dict.exists(varrayC(i, 1)) = False Then
           'not visible
        Sheet6.Cells(j, 33).value = varrayC(i, 1)
        
       j = j + 1
      
   
    End If
Next i


For l = 1 To UBound(varrayD, 1)
    dictdos.Add varrayD(l, 1), 1
Next


For l = 1 To UBound(varrayB, 1)


    If dictdos.exists(varrayB(l, 1)) = False Then
                
        Sheet6.Cells(k, 4).value = varrayB(l, 1)
        
       k = k + 1
      
   
    End If
Next l






Application.ScreenUpdating = True






End Sub
 
Upvote 0
Help

My code is below please help

Code:
Application.ScreenUpdating = False
Dim varrayC As Variant, varrayA As Variant, varrayB As Variant, varrayD As Variant
Dim dict As Object
Dim dictdos As Object
Dim j As Double
Dim k As Double


Set dict = CreateObject("scripting.dictionary")
Set dictdos = CreateObject("scripting.dictionary")




lastRow = Sheet15.Range("D" & Rows.Count).End(xlUp).Row
varrayA = Sheet15.Range("D1:D" & lastRow).value


lastRow = Sheet4.Range("C" & Rows.Count).End(xlUp).Row
varrayC = Sheet4.Range("C2:C" & lastRow).value


lastRow = Sheet6.Range("AG" & Rows.Count).End(xlUp).Row
varrayB = Sheet6.Range("AG2:AG" & lastRow).value


lastRow = Sheet16.Range("H" & Rows.Count).End(xlUp).Row
varrayD = Sheet16.Range("H2:H" & lastRow).value


On Error Resume Next
For i = 1 To UBound(varrayA, 1)
    dict.Add varrayA(i, 1), 1
Next


j = 1
k = 7




For i = 1 To UBound(varrayC, 1)


    If dict.exists(varrayC(i, 1)) = False Then
           'not visible
        Sheet6.Cells(j, 33).value = varrayC(i, 1)
        
       j = j + 1
      
   
    End If
Next i


For l = 1 To UBound(varrayD, 1)
    dictdos.Add varrayD(l, 1), 1
Next


For l = 1 To UBound(varrayB, 1)


    If dictdos.exists(varrayB(l, 1)) = False Then
                
        Sheet6.Cells(k, 4).value = varrayB(l, 1)
        
       k = k + 1
      
   
    End If
Next l






Application.ScreenUpdating = True






End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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