Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: how do you use macro in this situation

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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, NateO
    "Me no are no nice guy."

    [ This Message was edited by: NateO on 2002-04-25 10:34 ]

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    Minnesota
    Posts
    821
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •