Hi
Wondered if anyone has any ideas/experience on this and can give me some pointers?
I'm new to learning excel vba and am trying to create a few scripts to automate common tasks
https://pasteboard.co/JvX6kSK.png
Raw data (columns A and B)
1 Not in Plan
1 Pending
1 Pass
1 Fail
2 Hold
1 Block
1 Pending
1 Pending
3 Not in Plan
1 Pending
1 Pending
1 Pending
2 Pending
1 Pending
3 Not in Plan
Task 1
Script to review cells B1:B16, Any cell in this range which has text, script is to replace current text with text "Pending", pre-existing blank cells to stay blank (ignore)
I got this partly working, but it does not ignore blank rows
Sub Simple_Select()
Range("B1:B15").Value = "Pending"
End Sub
Task 2
Script to review cells A1:A16, if a cell in this range has a value of 2, the script is to replace cell to immediate right with text "Not in Plan", else if value is not 2 then leave cell to right as it is
I have no idea how to script this one at all (presumably some if statement needed) but nothing I tried to date gets me anywhere
ps if anyone knows how to format the affected cells background and text colour so only the edited ones get changed let me know that also
I get you can use such as below, but I only want to apply this to cells changed in above formulae
Range("B1:B16").Interior.Color = RGB(112, 48, 160)
Range("B1:B16").Font.Color = vbWhite
Thanks for tips in advance!
N
Wondered if anyone has any ideas/experience on this and can give me some pointers?
I'm new to learning excel vba and am trying to create a few scripts to automate common tasks

https://pasteboard.co/JvX6kSK.png
Raw data (columns A and B)
1 Not in Plan
1 Pending
1 Pass
1 Fail
2 Hold
1 Block
1 Pending
1 Pending
3 Not in Plan
1 Pending
1 Pending
1 Pending
2 Pending
1 Pending
3 Not in Plan
Task 1
Script to review cells B1:B16, Any cell in this range which has text, script is to replace current text with text "Pending", pre-existing blank cells to stay blank (ignore)
I got this partly working, but it does not ignore blank rows
Sub Simple_Select()
Range("B1:B15").Value = "Pending"
End Sub
Task 2
Script to review cells A1:A16, if a cell in this range has a value of 2, the script is to replace cell to immediate right with text "Not in Plan", else if value is not 2 then leave cell to right as it is
I have no idea how to script this one at all (presumably some if statement needed) but nothing I tried to date gets me anywhere
ps if anyone knows how to format the affected cells background and text colour so only the edited ones get changed let me know that also
I get you can use such as below, but I only want to apply this to cells changed in above formulae
Range("B1:B16").Interior.Color = RGB(112, 48, 160)
Range("B1:B16").Font.Color = vbWhite
Thanks for tips in advance!
N
Last edited: