Macro to consider another column as well when performing the 'Cut' function

sncb

Board Regular
Joined
Mar 17, 2011
Messages
168
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi All,

Im currently using this code that cuts off a record from Tab 'FollowUp' if there exists a unique identifier in column B and if a 'No' exist in Column M and pastes in Tab 'Test' with a date format but just realized that Column B records are not always unique and when similar they're separated by the record in Col A.

I need it to cut the record if Col M is 'No' AND to consider the records in Col A if records in Col B are similar and paste in Tab 'Hold"

I know Ive to add that code after the "If IsError" line of the code but just dont know how since Im very new to VB but planning to start working on it.

Anyone could recommend the code change required here.

Code:
Dim LastDate As Date
For intCounter = 2 To intNoLinesFollowUp
If Cells(intCounter, 13).Value = "No" Then
    If IsError(Application.Match(Cells(intCounter, 2), Sheets("Test").Columns("B"), 0)) Then
        Rows(intCounter).Cut Destination:=Sheets("Test").Range("A" & Rows.Count).End(xlUp).Offset(1)
        Sheets("Test").Range("R" & Rows.Count).End(xlUp).Offset(1).Value = Format(Date, "mm/dd/yy")
        
    End If
If IsDate(Sheets("Test").Range("R" & Rows.Count).End(xlUp).Value) Then
    LastDate = Sheets("Test").Range("R" & Rows.Count).End(xlUp).Value
Else
    LastDate = Date
End If
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi,

Anyone could recommend a solution.

Thanks in advance
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,853
Members
452,948
Latest member
UsmanAli786

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