+ Reply to Thread
Results 1 to 6 of 6

How to run a macro when user enters a value in a cell?

  1. #1
    serdar
    Guest

    How to run a macro when user enters a value in a cell?

    See the question about vbasic functions below also.



  2. #2
    KL
    Guest

    Re: How to run a macro when user enters a value in a cell?

    Hi serdar,

    You may want to use the Change event of the worksheet. For example copy the
    following code to the VBA module of your active worksheet and try changing
    value in cell [A1]:

    '---code start----
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Me.[a1]) Is Nothing Then _
    Call Test
    End Sub

    Sub Test()
    MsgBox "Hello!"
    End Sub
    '---code end----

    Reagrds,
    KL


    "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    news:usl70aQaFHA.900@tk2msftngp13.phx.gbl...
    > See the question about vbasic functions below also.
    >
    >




  3. #3
    serdar
    Guest

    Re: How to run a macro when user enters a value in a cell?

    thanks. this may be useful, and this is what i want to do actually, if u are
    interested:

    I have a workbook with one master worksheet and several others for each bank
    i work with.
    When i enter a new record in the master worksheet (for instance i get a
    check from citibank) this record should go to the appropriate place in the
    "citibank worksheet".

    Briefly, i have a master worksheet that has all the records that i entered,
    and others each has only the fitting records.




    "KL" <NOSPAMlapink2000@PLEASEhotmail.com>, haber iletisinde şunları
    yazdı:uP3N#iQaFHA.2496@TK2MSFTNGP14.phx.gbl...
    > Hi serdar,
    >
    > You may want to use the Change event of the worksheet. For example copy

    the
    > following code to the VBA module of your active worksheet and try changing
    > value in cell [A1]:
    >
    > '---code start----
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > If Not Intersect(Target, Me.[a1]) Is Nothing Then _
    > Call Test
    > End Sub
    >
    > Sub Test()
    > MsgBox "Hello!"
    > End Sub
    > '---code end----
    >
    > Reagrds,
    > KL
    >
    >
    > "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    > news:usl70aQaFHA.900@tk2msftngp13.phx.gbl...
    > > See the question about vbasic functions below also.
    > >
    > >

    >
    >




  4. #4
    KL
    Guest

    Re: How to run a macro when user enters a value in a cell?

    Hi serdar,

    In what you are describing there are a lot of variables to take into account
    when writing a code. If you need advice on how to write such a code, you
    will have to be a lot more specific about the workbook and data structure as
    well as the intended workflow.

    Regards,
    KL



    "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    news:e%23J7npQaFHA.2736@TK2MSFTNGP12.phx.gbl...
    > thanks. this may be useful, and this is what i want to do actually, if u
    > are
    > interested:
    >
    > I have a workbook with one master worksheet and several others for each
    > bank
    > i work with.
    > When i enter a new record in the master worksheet (for instance i get a
    > check from citibank) this record should go to the appropriate place in the
    > "citibank worksheet".
    >
    > Briefly, i have a master worksheet that has all the records that i
    > entered,
    > and others each has only the fitting records.
    >
    >
    >
    >
    > "KL" <NOSPAMlapink2000@PLEASEhotmail.com>, haber iletisinde şunları
    > yazdı:uP3N#iQaFHA.2496@TK2MSFTNGP14.phx.gbl...
    >> Hi serdar,
    >>
    >> You may want to use the Change event of the worksheet. For example copy

    > the
    >> following code to the VBA module of your active worksheet and try
    >> changing
    >> value in cell [A1]:
    >>
    >> '---code start----
    >> Private Sub Worksheet_Change(ByVal Target As Range)
    >> If Not Intersect(Target, Me.[a1]) Is Nothing Then _
    >> Call Test
    >> End Sub
    >>
    >> Sub Test()
    >> MsgBox "Hello!"
    >> End Sub
    >> '---code end----
    >>
    >> Reagrds,
    >> KL
    >>
    >>
    >> "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    >> news:usl70aQaFHA.900@tk2msftngp13.phx.gbl...
    >> > See the question about vbasic functions below also.
    >> >
    >> >

    >>
    >>

    >
    >




  5. #5
    Dave Peterson
    Guest

    Re: How to run a macro when user enters a value in a cell?

    I wouldn't do this. There's too many things that can go wrong. My typing could
    make it so that that event copies something to the wrong sheet and then I have
    to find where it went and correct it in multiple spots.

    In fact, if you use data|filter|autofilter, you may not even have to move the
    data to separate sheets. (I'd try my best to keep one set of data. If you have
    two copies, it won't be too long before one version is different from the other.

    But if you must, maybe you could use a program (on demand) that would move or
    copy your data.

    I'd borrow some code from Debra Dalgleish's site:
    http://www.contextures.com/excelfiles.html

    Create New Sheets from Filtered List -- uses an Advanced Filter to create
    separate sheet of orders for each sales rep visible in a filtered list; macro
    automates the filter. AdvFilterRepFiltered.xls 35 kb

    Ron de Bruin has an addin that may do what you want right out of the box:
    http://www.rondebruin.nl/easyfilter.htm

    If you're new to macros, you may want to read David McRitchie's intro at:
    http://www.mvps.org/dmcritchie/excel/getstarted.htm



    serdar wrote:
    >
    > thanks. this may be useful, and this is what i want to do actually, if u are
    > interested:
    >
    > I have a workbook with one master worksheet and several others for each bank
    > i work with.
    > When i enter a new record in the master worksheet (for instance i get a
    > check from citibank) this record should go to the appropriate place in the
    > "citibank worksheet".
    >
    > Briefly, i have a master worksheet that has all the records that i entered,
    > and others each has only the fitting records.
    >
    > "KL" <NOSPAMlapink2000@PLEASEhotmail.com>, haber iletisinde şunları
    > yazdı:uP3N#iQaFHA.2496@TK2MSFTNGP14.phx.gbl...
    > > Hi serdar,
    > >
    > > You may want to use the Change event of the worksheet. For example copy

    > the
    > > following code to the VBA module of your active worksheet and try changing
    > > value in cell [A1]:
    > >
    > > '---code start----
    > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > If Not Intersect(Target, Me.[a1]) Is Nothing Then _
    > > Call Test
    > > End Sub
    > >
    > > Sub Test()
    > > MsgBox "Hello!"
    > > End Sub
    > > '---code end----
    > >
    > > Reagrds,
    > > KL
    > >
    > >
    > > "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    > > news:usl70aQaFHA.900@tk2msftngp13.phx.gbl...
    > > > See the question about vbasic functions below also.
    > > >
    > > >

    > >
    > >


    --

    Dave Peterson

  6. #6
    serdar
    Guest

    Re: How to run a macro when user enters a value in a cell?

    Thank for advices Dave.
    I wrote the code and just thinking about the problem u have metioned.
    I'm gonna send the code to the newsgroup. Take a look if u r still
    interested.


    "Dave Peterson" <ec35720@netscapeXSPAM.com>, haber iletisinde sunlari
    yazdi:42A2186A.D0482DF4@netscapeXSPAM.com...
    > I wouldn't do this. There's too many things that can go wrong. My typing

    could
    > make it so that that event copies something to the wrong sheet and then I

    have
    > to find where it went and correct it in multiple spots.
    >
    > In fact, if you use data|filter|autofilter, you may not even have to move

    the
    > data to separate sheets. (I'd try my best to keep one set of data. If

    you have
    > two copies, it won't be too long before one version is different from the

    other.
    >
    > But if you must, maybe you could use a program (on demand) that would move

    or
    > copy your data.
    >
    > I'd borrow some code from Debra Dalgleish's site:
    > http://www.contextures.com/excelfiles.html
    >
    > Create New Sheets from Filtered List -- uses an Advanced Filter to create
    > separate sheet of orders for each sales rep visible in a filtered list;

    macro
    > automates the filter. AdvFilterRepFiltered.xls 35 kb
    >
    > Ron de Bruin has an addin that may do what you want right out of the box:
    > http://www.rondebruin.nl/easyfilter.htm
    >
    > If you're new to macros, you may want to read David McRitchie's intro at:
    > http://www.mvps.org/dmcritchie/excel/getstarted.htm
    >
    >
    >
    > serdar wrote:
    > >
    > > thanks. this may be useful, and this is what i want to do actually, if u

    are
    > > interested:
    > >
    > > I have a workbook with one master worksheet and several others for each

    bank
    > > i work with.
    > > When i enter a new record in the master worksheet (for instance i get a
    > > check from citibank) this record should go to the appropriate place in

    the
    > > "citibank worksheet".
    > >
    > > Briefly, i have a master worksheet that has all the records that i

    entered,
    > > and others each has only the fitting records.
    > >
    > > "KL" <NOSPAMlapink2000@PLEASEhotmail.com>, haber iletisinde şunları
    > > yazdı:uP3N#iQaFHA.2496@TK2MSFTNGP14.phx.gbl...
    > > > Hi serdar,
    > > >
    > > > You may want to use the Change event of the worksheet. For example

    copy
    > > the
    > > > following code to the VBA module of your active worksheet and try

    changing
    > > > value in cell [A1]:
    > > >
    > > > '---code start----
    > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > > If Not Intersect(Target, Me.[a1]) Is Nothing Then _
    > > > Call Test
    > > > End Sub
    > > >
    > > > Sub Test()
    > > > MsgBox "Hello!"
    > > > End Sub
    > > > '---code end----
    > > >
    > > > Reagrds,
    > > > KL
    > > >
    > > >
    > > > "serdar" <yuzbasioglu@kablonet.com.tr> wrote in message
    > > > news:usl70aQaFHA.900@tk2msftngp13.phx.gbl...
    > > > > See the question about vbasic functions below also.
    > > > >
    > > > >
    > > >
    > > >

    >
    > --
    >
    > Dave Peterson




+ 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