Finding the first numbers and moving to another cell

Balmer07

New Member
Joined
Feb 14, 2018
Messages
45
Office Version
  1. 365
Hi,

I am trying to speed up a process I currently do, I get sent an email everyday of goods which have been processed. However I want to create a macro that carries out a few transactions for me in one go to save some time.

I get an email like below:

3-PPP-00016-GH1-50%
14-PPP-00017-GH1-50%
20-PPP-00018-GH1-50%

The first numbers in each line are the quantities processed (3, 14, 20). Basically if I copy these lines into column 'B' I want to copy the quantity into column 'C' then delete the data up until the first 0 of the 00016 code

I hope this makes sense, please let me know if you have an idea of how to do this.

Thanks
Stevie
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
If you want to replace the text with the 1st 2 parts removed (e.g., 3-PPP-00016-GH1-50% with 00016-GH1-50%), you will need to wrote some VBA code. If you are alright with having a new column with the 1st 2 parts removed, this is straight forward. In the following, I am assuming your data starts in cell B2.

In C2, use the formula:
=LEFT(B2,FIND("-",B2)-1)

In D2, use the formula:
=RIGHT(B2,LEN(B2)-(FIND("-",B2)+4))
 
Upvote 0
I should have said I am trying to right the code for it. Did not think of using 'Find' this should make life a lot easier

Thanks
 
Upvote 0
Quick question, I can't seem to get the formula to work in VBA, below is what I am inputting and it is returning with an error. Active Cell is Row 'C', and I am wanting to look into Column 'B'

ActiveCell.FormulaR1C1 = "=Left(RC[-1],FIND(" - ",RC[-1])-1)"

Any ideas?
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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