VBA to automate formatting

ChrisS92

New Member
Joined
Mar 19, 2015
Messages
18
Hello,

I have a particular set of data:

AA
BB
AB
CC
CA
CD
DA
FA
FD
FC

I want to create an if/then statement to delete all values that contain either an "A" or a "D" for purposes of eliminating irrelevant data. Sometimes I'll have more values, sometimes less, but I always want the same conditions for the clean up to apply. What would the code look like?

Thanks in advance!
 
No definitely milliseconds (the code took between 39 & 44 milliseconds in total each run with screenupdating on (the array code I used earlier in thread is roughly 5 milliseconds each run slower with screenupdating off (which is about 5 milliseconds faster than having it off)).
Maybe I am misunderstanding what numbers apply to what, but 5 milliseconds is different than to 0.05 milliseconds you posted.
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Maybe I am misunderstanding what numbers apply to what, but 5 milliseconds is different than to 0.05 milliseconds you posted.

Oops typo in the original post it is 5 milliseconds (although FastExcel does measure to the second decimal milliseconds)
 
Upvote 0
Rick & MARK858,

Thanks to both you guys for taking the time to show ways on improving the code that I wrote. You guys can probably tell by the lack of sophistication in my code that I am a relative noob at coding. Rick, you constantly impress me with the way you are able to reduce the number of lines/routines that it takes to accomplish a given task- kudos.

As an observation, I was going through the "Zero Reply Posts" yesterday when I came across the original post in this thread and it had hardly any views and was on one of the last pages probably getting ready to roll off. I saw that it was an easy "do" so I wrote the code. Now look at the attention the post is getting for a very simple request that went ignored for over two days. The dynamics of the board are interesting. The thing that really sticks out is that the OP has neglected to reach out and thank anyone as of yet.

Again, thanks guys, I appreciate all that I learned from this round of posts.

igold
 
Upvote 0

Forum statistics

Threads
1,215,310
Messages
6,124,181
Members
449,147
Latest member
sweetkt327

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