If value in one row then return value in another row

Glanza270bhp

New Member
Joined
Oct 16, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

Another (very) newbie here!
I have a database where I want VBA to search all data in column j for a value and then column h and if both values are found in the same row, then return the words "high priority" in column k.

I have tried the below however I am getting 'type mismatch' error. Can anyone help please?

Many thanks in advance,

Rachel

StartRow = 1
LASTROW = Cells.Find("*", Cells(1), xlFormulas, xlWhole, xlByRows, xlPrevious).Row

For Row = StartRow To LASTROW Step 1


If Cells(Row, 10) = 30 And Cells(Row, 8) = 20 Then
Cells(Row, 11).Value = "HIGH PRIORITY"
End If


Next Row
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Welcome to the Board!

"ROW" is a reserved word. You should NEVER used reserved words as names of your variables, procedures, or functions, as this can lead to errors and unexpected results.
Try using something like "MyRow" or "r" or "rw" instead.
 
Upvote 0
Thank you Joe4 for your help however even changing the above as suggested, I am still getting the same error message?

Rachel
 
Upvote 0
Please post the entire procedure, and let me know exactly which line of code is being highlighted when the error occurs.
Also, is there a specific column that we can always look to in order to find the last row of data, for your purposes? I prefer to use that method instead of "Cells.Find(...", if possible.
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,194
Members
448,951
Latest member
jennlynn

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