+ Reply to Thread
Results 1 to 6 of 6

update details using vba

  1. #1
    Noemi
    Guest

    update details using vba

    Hi
    I have a validation list over 2 cells which when a specific word is selected
    from the list then I need the word 'Please specify:' to be shown in another
    cell but when any other word is selected from the list is is empty then I
    dont want the 'Please specify:' to be visible.

    Can anyone help.

    I have tried the following but does not work and I dont know why.

    Private Sub Worksheet_selectionChange(ByVal Target As Range)

    If Target.Address = "G26" Then
    If Range("G26").Value = "Other" Then
    Range("E28").Value = "Please specify:"
    Else
    Range("E28").Value = ""
    End If
    End If

    End Sub

    Thanks
    Noemi

  2. #2
    Registered User
    Join Date
    01-18-2005
    Location
    Australia
    Posts
    29
    Hi Noemi

    Try:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$G$26" Then

    If Range("G26").Value = "Other" Then
    Range("E28").Value = "Please specify:"
    Else
    Range("E28").Value = ""
    End If
    End If


    End Sub

    Regards
    Shaun

  3. #3
    Noemi
    Guest

    Re: update details using vba

    Hi Shaun
    It did not help, still nothing happens.

    Any other suggestions.

    Thanks
    Noemi

    "ShaunM" wrote:

    >
    > Hi Noemi
    >
    > Try:
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > If Target.Address = "$G$26" Then
    >
    > If Range("G26").Value = "Other" Then
    > Range("E28").Value = "Please specify:"
    > Else
    > Range("E28").Value = ""
    > End If
    > End If
    >
    >
    > End Sub
    >
    > Regards
    > Shaun
    >
    >
    > --
    > ShaunM
    > ------------------------------------------------------------------------
    > ShaunM's Profile: http://www.excelforum.com/member.php...o&userid=18610
    > View this thread: http://www.excelforum.com/showthread...hreadid=479018
    >
    >


  4. #4
    Shatin
    Guest

    Re: update details using vba

    Works on my computer. But Shaun, why must the address be "$G$26" and can't
    be simply "G26"?

    Thanks!

    "Noemi" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Shaun
    > It did not help, still nothing happens.
    >
    > Any other suggestions.
    >
    > Thanks
    > Noemi
    >
    > "ShaunM" wrote:
    >
    > >
    > > Hi Noemi
    > >
    > > Try:
    > >
    > > Private Sub Worksheet_Change(ByVal Target As Range)
    > >
    > > If Target.Address = "$G$26" Then
    > >
    > > If Range("G26").Value = "Other" Then
    > > Range("E28").Value = "Please specify:"
    > > Else
    > > Range("E28").Value = ""
    > > End If
    > > End If
    > >
    > >
    > > End Sub
    > >
    > > Regards
    > > Shaun
    > >
    > >
    > > --
    > > ShaunM
    > > ------------------------------------------------------------------------
    > > ShaunM's Profile:

    http://www.excelforum.com/member.php...o&userid=18610
    > > View this thread:

    http://www.excelforum.com/showthread...hreadid=479018
    > >
    > >




  5. #5
    Dave Peterson
    Guest

    Re: update details using vba

    The .address property has an option that allows you to include those dollar
    signs or not.

    If you don't want them:
    if Target.Address(rowabsolute:=False, columnabsolute:=False) = "G26" then

    or simply:
    if Target.Address(0,0) = "G26" then

    (False and 0 will be treated the same)


    Shatin wrote:
    >
    > Works on my computer. But Shaun, why must the address be "$G$26" and can't
    > be simply "G26"?
    >
    > Thanks!
    >
    > "Noemi" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi Shaun
    > > It did not help, still nothing happens.
    > >
    > > Any other suggestions.
    > >
    > > Thanks
    > > Noemi
    > >
    > > "ShaunM" wrote:
    > >
    > > >
    > > > Hi Noemi
    > > >
    > > > Try:
    > > >
    > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > >
    > > > If Target.Address = "$G$26" Then
    > > >
    > > > If Range("G26").Value = "Other" Then
    > > > Range("E28").Value = "Please specify:"
    > > > Else
    > > > Range("E28").Value = ""
    > > > End If
    > > > End If
    > > >
    > > >
    > > > End Sub
    > > >
    > > > Regards
    > > > Shaun
    > > >
    > > >
    > > > --
    > > > ShaunM
    > > > ------------------------------------------------------------------------
    > > > ShaunM's Profile:

    > http://www.excelforum.com/member.php...o&userid=18610
    > > > View this thread:

    > http://www.excelforum.com/showthread...hreadid=479018
    > > >
    > > >


    --

    Dave Peterson

  6. #6
    Shatin
    Guest

    Re: update details using vba

    Dave,

    Many thanks for the explanation!

    "Dave Peterson" <[email protected]> wrote in message
    news:[email protected]...
    > The .address property has an option that allows you to include those

    dollar
    > signs or not.
    >
    > If you don't want them:
    > if Target.Address(rowabsolute:=False, columnabsolute:=False) = "G26"

    then
    >
    > or simply:
    > if Target.Address(0,0) = "G26" then
    >
    > (False and 0 will be treated the same)
    >
    >
    > Shatin wrote:
    > >
    > > Works on my computer. But Shaun, why must the address be "$G$26" and

    can't
    > > be simply "G26"?
    > >
    > > Thanks!
    > >
    > > "Noemi" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hi Shaun
    > > > It did not help, still nothing happens.
    > > >
    > > > Any other suggestions.
    > > >
    > > > Thanks
    > > > Noemi
    > > >
    > > > "ShaunM" wrote:
    > > >
    > > > >
    > > > > Hi Noemi
    > > > >
    > > > > Try:
    > > > >
    > > > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > > >
    > > > > If Target.Address = "$G$26" Then
    > > > >
    > > > > If Range("G26").Value = "Other" Then
    > > > > Range("E28").Value = "Please specify:"
    > > > > Else
    > > > > Range("E28").Value = ""
    > > > > End If
    > > > > End If
    > > > >
    > > > >
    > > > > End Sub
    > > > >
    > > > > Regards
    > > > > Shaun
    > > > >
    > > > >
    > > > > --
    > > > > ShaunM
    > > >

    > ------------------------------------------------------------------------
    > > > > ShaunM's Profile:

    > > http://www.excelforum.com/member.php...o&userid=18610
    > > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=479018
    > > > >
    > > > >

    >
    > --
    >
    > 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