clarksonneo
12-07-2010, 06:57 AM
Hi,
I would like to set y = “the row number” at which the button I click locates.
Eg, If I click the button at row 8, then y would be 8.
Could you please tell me the code for doing that?
I hope that when I click the button at a row, a picture named by the text in that row can be inserted.
Eg, when I click the button at row 8, A.jpg can be inserted.
Please see the code and diagram below
Sub Picture_Click
‘----------------------------------------------------------------
ChDir "C:\Users\XX\Desktop\picture\"
‘----------------------------------------------------------------
y = “the row number” at which the button I click locates
x = Cells(y, 4).Value
ActiveSheet.Pictures.Insert (x & ".jpg")
End Sub
Thanks
I would like to set y = “the row number” at which the button I click locates.
Eg, If I click the button at row 8, then y would be 8.
Could you please tell me the code for doing that?
I hope that when I click the button at a row, a picture named by the text in that row can be inserted.
Eg, when I click the button at row 8, A.jpg can be inserted.
Please see the code and diagram below
Sub Picture_Click
‘----------------------------------------------------------------
ChDir "C:\Users\XX\Desktop\picture\"
‘----------------------------------------------------------------
y = “the row number” at which the button I click locates
x = Cells(y, 4).Value
ActiveSheet.Pictures.Insert (x & ".jpg")
End Sub
Thanks