how do you use macro in this situation

elisa

New Member
Joined
Apr 24, 2002
Messages
7
Hello, Mr. Excel. I have a question regarding how to use Macro or script in Excel. Currently, I was entering data into excel file. And
for example, in one of the cell it writes "en: Stock span" and the "en:" and "span" part repeat itself through the whole column but the "Stock" part changes every time. Is there any automated way to creat a macro or script that format the cell in form of "en:" -- ask for input data -- "span"? so it looks like "en: ___ span" and this should all be in one cell. The whole column should be formated that way until the end of the file. So the user only need to type in "Stock" part. It will be even better if it ask for that part automatically. And other easier question, what if only the "en:" repeats itself but we need to insert data after that in the same cell. Is there any way that I can type in data and format it to "en: Data" form?
Thank you very much.
Yours Elisa
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You could just type in the stock names and run the code below with inserts text before and after for each cell in Column A.
Code:
Sub Frmt()
Application.ScreenUpdating = False
For Each cell In Range("A:A")
cell.Value = "en: " & cell.Value & " span"
Next
Application.ScreenUpdating = True
End Sub

If you don't want the "span" as part of it, you can delete: & " span" from your macro. Or change the text, column letter as needed, etc....

Hope this helps.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
"Me no are no nice guy."
This message was edited by NateO on 2002-04-25 10:34
 
Upvote 0
Another option would be to have the user enter the stock part in a separate cell. Then have the cell to the left or right of it have the following formula:

="en: "& cell & "span"

Good luck.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

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