Results 1 to 3 of 3

excel/vba rgb value in cell

Threaded View

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Padua, Italy
    MS-Off Ver
    Excel 2007
    Posts
    2

    excel/vba rgb value in cell

    hello,
    I have this problem that is driving me crazy!

    row a row b
    uk RGB(191, 13, 31)
    usa RGB(11, 47, 107)

    I have a form with a combobox where there is a list from row a, now with a macro I should change the background of a texbox with the color of row b.
    I get the error at thi " TextBox1.BackColor = y"
    this is the macro

    Private Sub CBcolore_Change()
    
    Dim rng As Range
    Dim z
    Dim col
    Dim y
    
        x = UserForm1.CBcolore.Value
        z = Sheets("ELENCHI").Range("B2:B1000")
            With Sheets("ELENCHI").Range("G1:G10000")
                Set rng = .Find(What:=x, LookIn:=xlValues)
                    If Not rng Is Nothing Then
                        Application.Goto rng, True
                        
        ActiveCell.Offset(0, 1).Select
    
        y = ActiveCell.Value
    
        TextBox1.BackColor = y
                        Exit Sub
                    End If
            End With
    
    end sub


    thanks for your help
    Last edited by arlu1201; 09-21-2012 at 02:04 PM.

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