Using picture in comment

Technick

New Member
Joined
Mar 22, 2013
Messages
1
Hi,

I'm making a simple database with a picture in comment on cell D2:

Type of equipmentManufacturerName of equipmentWeight
EngineAW3035
CraneAR255
EngineBW3232

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>



My problem is that I can't get the picture in the comment to a userform.
I really appreciate any help I can get regarding this matter.

Code:
Private Sub UserForm_Initialize()
    Dim ws As Worksheet
    Dim LR As Long
    Dim Cell As Range
    Dim List As New Collection
    Dim Item As Variant
    Set ws = ActiveSheet
    With ws
        LR = .Cells(.Rows.Count, 1).End(xlUp).Row
        For Each Cell In .Range("A2:A" & LR)
            With Cell
                On Error Resume Next
                List.Add .Text, CStr(.Value)
                On Error GoTo 0
            End With
        Next Cell
        For Each Item In List
            ComboBox1.AddItem Item
        Next Item
    End With
End Sub
Private Sub ComboBox1_Change()
    Dim ws As Worksheet
    Dim LR As Long
    Dim Cell As Range
    Dim List As New Collection
    Dim Item As Variant
    Set ws = ActiveSheet
    With ws
        LR = .Cells(.Rows.Count, 1).End(xlUp).Row
        ComboBox2.Clear
        For Each Cell In .Range("A2:A" & LR)
            With Cell
                If .Text = ComboBox1.Value Then
                    On Error Resume Next
                    List.Add .Offset(0, 1).Text, CStr(.Offset(0, 1).Value)
                    On Error GoTo 0
                End If
            End With
        Next Cell
        For Each Item In List
            ComboBox2.AddItem Item
        Next Item
    End With
End Sub

Private Sub ComboBox2_Change()
    Dim ws As Worksheet
    Dim LR As Long
    Dim Cell As Range
    Dim List As New Collection
    Dim Item As Variant
    Set ws = ActiveSheet
    With ws
        LR = .Cells(.Rows.Count, 1).End(xlUp).Row
        ComboBox3.Clear
        For Each Cell In .Range("A2:A" & LR)
            With Cell
                If .Text = ComboBox1.Value Then
                    If .Offset(0, 1).Text = ComboBox2.Value Then
                        On Error Resume Next
                        List.Add .Offset(0, 2).Text, CStr(.Offset(0, 2).Value)
                        On Error GoTo 0
                    End If
                End If
            End With
        Next Cell
        For Each Item In List
            ComboBox3.AddItem Item
        Next Item
    End With
End Sub
Private Sub ComboBox3_Change()
    Dim ws As Worksheet
    Dim LR As Long
    Dim Cell As Range
    Dim List As New Collection
    Dim Item As Variant
    Dim objComment As Comment
    Set ws = ActiveSheet
    With ws
        LR = .Cells(.Rows.Count, 1).End(xlUp).Row
        ComboBox4.Clear
        For Each Cell In .Range("A2:A" & LR)
            With Cell
                If .Text = ComboBox1.Value Then
                    If .Offset(0, 1).Text = ComboBox2.Value Then
                        On Error Resume Next
                        List.Add .Offset(0, 3).Text, CStr(.Offset(0, 3).Value)
                        On Error GoTo 0
                    End If
                End If
            End With
        Next Cell
        For Each Item In List
            ComboBox4.AddItem Item
        Next Item
    End With
End Sub
 
Last edited:

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,064
Messages
6,122,939
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top