+ Reply to Thread
Results 1 to 8 of 8

Entry based Execution of Macro

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128

    Entry based Execution of Macro

    Hello,


    I have to make eighty to ninety entries daily in Column B. Then transfer these entries to another column N,(by copy/paste) after that a maco "text to column" is executed. Now I have linked Column B to N like =B2, =B3, etc. etc. thus instead of copy/paste, the data when entered in Column B, is automatically going to Column N. I wish that the macro (text to entry) may be executed by each entry made in Column B. Is it possible with a macro? thanks.

    Flower R
    Last edited by Flower R; 12-20-2008 at 05:46 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    The bit of code goes into the worksheet module, right click on the sheet tab,view code and paste there
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Column = 2 Then
            Call Macro5 'your macro name goes here
        End If
    End Sub
    Replace Macro5 with your macro name
    It may become a pain in the butt if the macro kicks in every time you make a change in Column B.

  3. #3
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128
    One thing more if "If Target.Column = 2" can be changed according to column number or it has to remain always 2. I mean if the work is in Column B, it is 2, and if it in C it is three and so on?(I ask this because the code can be used in other sheets also). Thanks.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    Quote Originally Posted by Flower R View Post
    One thing more if "If Target.Column = 2" can be changed according to column number or it has to remain always 2. I mean if the work is in Column B, it is 2, and if it in C it is three and so on?(I ask this because the code can be used in other sheets also). Thanks.
    Yes...........

  5. #5
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128
    Quote Originally Posted by davesexcel View Post
    Yes...........
    It is giving problem. Becuase when I tried to create macro for column E where value is, it started showing Formula =B1 instead of showing the value. Is it possible that the cell should only show value not the formula and macro may be cell-based not column-based. (The range should be cell). so whenever an entry is made in column b it is transferred to E and cell based macro executes. Thanks.
    Attached Files Attached Files

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read the forum rules below and make sure you post the question to the correct group

    Your example refers to different columns to your original post

    See if this helps

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Long, TRow As Long
    If Target.Cells.Count > 1 Then Exit Sub
        If Target.Column = 2 Then
            TRow = Target.Row
            Cells(TRow, "E").Formula = "=B" & TRow
            For i = 1 To Len(Target)
                Cells(TRow, 5 + i).Value = Mid(Target, i, 1)
            Next i
        End If
    End Sub
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    Quote Originally Posted by Flower R View Post
    It is giving problem. Becuase when I tried to create macro for column E where value is, it started showing Formula =B1 instead of showing the value. Is it possible that the cell should only show value not the formula and macro may be cell-based not column-based. (The range should be cell). so whenever an entry is made in column b it is transferred to E and cell based macro executes. Thanks.
    Is this a different question??
    Your original question has been answered, you have not supplied the code you said you had

  8. #8
    Forum Contributor
    Join Date
    10-10-2008
    Location
    western hemisphere
    Posts
    128
    Yes You are right. I made mistake. I will try to make fresh thread. Sorry for the inconvenience. to you and VBA.
    Last edited by Flower R; 12-20-2008 at 05:16 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1