Consulting

Results 1 to 4 of 4

Thread: UserForm Caption text with a cell ...

  1. #1
    VBAX Regular
    Joined
    Dec 2012
    Location
    Kabul - Afghanistan
    Posts
    40
    Location

    Exclamation UserForm Caption text with a cell ...

    Hi dear Friends!
    I need a way of a userform code that connect or link text of a cell like A1 of sheet1 to userform caption text.
    I mean the when i type in cell A1 Good the userform caption must set Good. Thanks plz help me.
    I like to be help full to my dear friends and I like Help full friends. Because ( A Friend in need is A Friend in dead)

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    You could put this in the sheet's code module

    [VBA]Private Sub Worksheet_Change(ByVal Target As Range)
    Dim keyRange As Range
    Set keyRange = Range("A1")

    On Error Resume Next
    Set keyRange = Application.Intersect(keyRange, keyRange.Precedents)
    On Error GoTo 0

    If Not Nothing Is Application.Intersect(Target, keyRange) Then
    UserForm1.Caption = keyRange.Cells(1, 1).Text
    End If
    End Sub[/VBA]

  3. #3
    VBAX Regular
    Joined
    Dec 2012
    Location
    Kabul - Afghanistan
    Posts
    40
    Location
    Thanks.
    But I have Five userforms named userform1, userform2 and so on. I want to apply A1 cell for userform1, A2 cell for userform2 and so on for their caption titles. Thanks please help. and also it must apply in whole workbook. I mean when i open this userform in every sheets it must names Sheet1 Range(A1). Please Help.

  4. #4
    VBAX Regular
    Joined
    Dec 2012
    Location
    Kabul - Afghanistan
    Posts
    40
    Location
    Plz Help some one.

Posting Permissions

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