View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Omega Omega is offline
external usenet poster
 
Posts: 15
Default Display picture according to active cell

Dear Excel 2007 Experts:

The following code works fine in my application:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngInter As Range
If Target.Cells.Count = 1 Then
Set rngInter = Intersect(Range("SchedulingBlocks"), Target)
'SchedulingBlocks is range E5:AB555
If Not rngInter Is Nothing Then 'Check current contents
If Target.Formula < "1" Then
Target.Value = 1
Else
Target.Formula = "=INPUT!" & Target.Offset(, 4).Address
End If
End If
End If
End Sub

The code above mimics the behavior of a checkbox in cells E5:AB555. When one
of the cells in the range is selected, it fills the selected cell with the
value €œ1€ or else it fills a formula.

OBJECTIVE: Insert additional lines that will accommodate the following:

€’ I have 24 dynamic pictures taken by the camera feature of excel 2007.
€’ Each picture should represent one of the 24 columns €“ E to AB.
€’ Possible user scenario 1: When the selected cell is in column E, the code
should display Picture 001.
€’ Possible user scenario 2: When the selected cell is in column F, the code
should display Picture 002.
€’ Possible user scenario 3: When the selected cell is in column AB, the code
should display Picture 024.
€’ This should also be true to the rest of the columns like G for Picture
003, H for Picture 004, I for Picture 005 and so on€¦
€’ All 24 pictures will only display in one the same spot, displaying only
the corresponding picture of the column where the selected/active cell is.

Please help.

Thank you very much,

Omega