VBA code to populate text in another column

KMJM2019

New Member
Joined
Jan 2, 2019
Messages
10
Hello,
I've asked a similar question, but I keep getting errors and I'm not sure why. I have to use VBA because I'm running a daily report that changes constantly, and I've been asked to automate everything, including things that would be easy with regular Excel formulas. Anyway, I need to reference two columns, then have another column populate with text. For example, column M has a code "ABC", and column L says "not reviewed". I need column O to then spit out "email Kevin". It seems like the problem is happening when both of these criteria aren't met, the program just stops/gets ignored/doesn't run, I'm not sure which. This is the last part of a much larger program, and everything else has been working great, thanks to Mr. Excel!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Please post the relevant section of code that you have so we can help you debug it.
 
Upvote 0
Code:
Sub MM2() 
    Dim lr As Long 
    lr = Cells(Rows.Count, "J").End(xlUp).Row 
    Range("O2:O" & lr).Formula = "=IF(J2=""ATO"",""Automated"",IF(AND(J2=""PRD"",L2=""waiting""),""Manual"",""""))" 
End Sub

This is the part of the code, all it does is put this formula in EVERY column instead of just one. Thank you!
 
Last edited by a moderator:
Upvote 0
The formula in your VBA code does not seem to match your original description.
Can you give us an example of your data and let us know exactly what you expect to happen, and what is actually currently happening with your current VBA code?
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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