lizsunnysideup
New Member
- Joined
- Jun 29, 2019
- Messages
- 36
Hello,
Can someone please help me with this? I am using a Dim statement in VBA but would like to expand my text to the next column over. Here's what I have so far:
What I'd like the macro to do is additionally add the text "Ok" to the next column over to the right, so that every time there is an "Exclude" in column D, there is an "Ok" next to it in column E. I tried using: Range("D" & a).Value = "Exclude" And Range("E" & a).Value = "Ok" but this didn't seem to work. The system says Type Mismatch. Additionally, how would I highlight all rows that say "Exclude" to appear in yellow? And final question-I know I have an almost NON-EXISTENT understanding of how VBA works, but is there any online videos that one might recommend? There are a TON out there, so if there's a series that one might recommend over the others, would be so helpful!
Thank you so much for taking the time to read this, and hopefully responding.
Can someone please help me with this? I am using a Dim statement in VBA but would like to expand my text to the next column over. Here's what I have so far:
Code:
Sub CommercialMarketPlace()
ActiveSheet.Select
Dim a As Long
For a = 1 To Cells(Rows.Count, "S").End(xlUp).Row
If Range("S" & a).Value = "DRUG NOT COVERED; INSTITUTIONAL DRUGS NOT COVERED" And Range("D" & a).Value = " Or _
Range("S" & a).Value = "DRUG NOT COVERED; INSTITUTIONAL DRUGS NOT COVERED" And Range("D" & a).Value = Then
Range("D" & a).Value = "Exclude"
End If
Next a
End Sub
What I'd like the macro to do is additionally add the text "Ok" to the next column over to the right, so that every time there is an "Exclude" in column D, there is an "Ok" next to it in column E. I tried using: Range("D" & a).Value = "Exclude" And Range("E" & a).Value = "Ok" but this didn't seem to work. The system says Type Mismatch. Additionally, how would I highlight all rows that say "Exclude" to appear in yellow? And final question-I know I have an almost NON-EXISTENT understanding of how VBA works, but is there any online videos that one might recommend? There are a TON out there, so if there's a series that one might recommend over the others, would be so helpful!
Thank you so much for taking the time to read this, and hopefully responding.