![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 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 |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
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
Hope this helps. _________________ Cheers, NateO "Me no are no nice guy." [ This Message was edited by: NateO on 2002-04-25 10:34 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Minnesota
Posts: 821
|
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. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|