DrummerAndy68
New Member
- Joined
- Jul 11, 2022
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello,
I have created a spreadsheet for my team to keep track of batch programs that are being ran. There are 100 cells (C2:C101) on Sheet1 where they can enter their batches. Multiple batches look something like this:
BI-EBTDM-DLY, BI-SNDDM-DLY or IN-PRSDX-MLY, IN-RCSDX-MLY, IN-MEDF-DLY
There are specific rules I want the team to follow, but sometimes they don't, so I would like to use VBA to correct the most common mistakes which include:
I know how to use Replace and Trim to make the corrections. However, the main thing I need help with is, as soon as they finish typing or copying in their batches into a cell then leave the cell, I want to evaluate what they just entered and update that specific cell if they made any of the previously listed mistakes.
I have created a spreadsheet for my team to keep track of batch programs that are being ran. There are 100 cells (C2:C101) on Sheet1 where they can enter their batches. Multiple batches look something like this:
BI-EBTDM-DLY, BI-SNDDM-DLY or IN-PRSDX-MLY, IN-RCSDX-MLY, IN-MEDF-DLY
There are specific rules I want the team to follow, but sometimes they don't, so I would like to use VBA to correct the most common mistakes which include:
- Not putting a space after a comma (BI-EBTDM-DLY,BI-SNDDM-DLY)
- Putting a space before a comma (BI-EBTDM-DLY , BI-SNDDM-DLY)
- Putting a space before and not after a comma (BI-EBTDM-DLY ,BI-SNDDM-DLY)
- Using underscores instead of hyphens (BI-EBTDM_DLY, BI_SNDDM-DLY)
- Putting a space at the beginning ( BI-EBTDM-DLY, BI-SNDDM-DLY)
- Putting a space at the end (BI-EBTDM-DLY, BI-SNDDM-DLY )
- Using the word "and" (IN-PRSDX-MLY, IN-RCSDX-MLY, and IN-MEDF-DLY)
I know how to use Replace and Trim to make the corrections. However, the main thing I need help with is, as soon as they finish typing or copying in their batches into a cell then leave the cell, I want to evaluate what they just entered and update that specific cell if they made any of the previously listed mistakes.
Batch Request Queue - Andy.xlsm | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | NUM | TESTER | BATCHES | ASOF DATE | ||
2 | 1 | Revathi | BI-EBTDM-DLY , BI-SNDDM-DLY | 10/03/2022 | ||
3 | 2 | Andy | MU-BEDMQ-DLY, MU-BEDBC-DLY | 10/31/2022 | ||
4 | 3 | Patty | IN-PRSDX-MLY ,IN-RCSDX-MLY,IN-MEDF-DLY | 01/01/2023 | ||
INT04 |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
C2 | Expression | =AND($F2<>"",$K1<>"",$B2<>"",$K2="") | text | NO |
A2:L2 | Expression | =AND($H$2<>"",$J$2="") | text | NO |
A2:L101 | Expression | =$K2<>"" | text | NO |
B3:L101 | Expression | =AND($F3<>"",$K2<>"",$B3<>"",$K3="") | text | NO |
Cells with Data Validation | ||
---|---|---|
Cell | Allow | Criteria |
B2:B4 | List | =Testers |