cell referencing

jasman

Board Regular
Joined
Oct 30, 2010
Messages
141
Im creating a catalogue of images which have four versions of each based on 4 different colours. I then have a blank page where the image is inserted based on user entry in another cell for the colour they want. They end up with an image consisting if 4 different images each in different colours.

However it all works, but the problem is that for example if a yellow image is inserted by the user but then chnaged to green, the green image gets inserted in a different location on the page from the yellow although I have cell referenced in the macro as below:

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheet2.Pictures.Delete
'rear springs
If Sheet10.Cells(3, 2).Value = "X" Then
ActiveSheet.Shapes("Picture 96").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Range("f9").Select
ActiveSheet.Paste
Sheets("Springs").Select


ElseIf Sheet10.Cells(3, 2).Value = "U" Then

ActiveSheet.Shapes("Picture 97").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Range("f9").Select
ActiveSheet.Paste
Sheets("Springs").Select
End If
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I think you can use something like:

Code:
ActiveSheet.Shapes("Picture 97").left = ActiveSheet.Shapes("Picture 96").left

...with both 'left' and 'top' - untested as my Excel is busy. If it turns out I was way off base then at least you got a bump! :)
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,261
Members
452,901
Latest member
LisaGo

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