macro to manipulate text

jemc2000

New Member
Joined
Apr 29, 2002
Messages
3
I have a column which contains data like this: F540044000
I need help writing a macro which will remove the zero in the 4th place, put 38 in the beginning, and remove the last two zeroes.
So it will look like this: 38F540440
The sheet changes, so I will need to be able to run this over and over again.
Thank you.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
On 2002-04-30 11:07, jemc2000 wrote:
I have a column which contains data like this: F540044000
I need help writing a macro which will remove the zero in the 4th place, put 38 in the beginning, and remove the last two zeroes.
So it will look like this: 38F540440
The sheet changes, so I will need to be able to run this over and over again.
Thank you.
Hi,
You can do this with a formula:
="38"&LEFT(A1,3)&LEFT(RIGHT(A1,6),4)
Will that work or how will you use a macro? I may be just a little confused :eek:)
 
Upvote 0
I get emailed this spreadsheet weekly. So every week I need to basically be able to hit a control-key and have it perform this function on a column of numbers (these are job numbers, usually about 500 of them).
 
Upvote 0
You could use a procedure like the following:

Code:
Sub chgIn()
Dim cl As Range
For Each cl In [a:a] 'Change letters to column of choice
If cl <> "" Then cl = "32" & Left([cl].Value, 3) & Mid([cl], 5, 4)
Next
End Sub

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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