Attribute VB_Name = "Module2"
'Sub MatchMap()
'ScreenUpdating = False

'deleting existing image
'ActiveSheet.Unprotect
'For Each Shape In Worksheets("Event Info").Shapes
    '        If Not Intersect(Shape.TopLeftCell, Worksheets("Event Info").Cells(22, 6)) Is Nothing Then
     '           Shape.Delete
     '           Exit For
      '      End If
    'Next Shape

'looking for new map based on Track name entered

'Dim Track As String
'Sheets("Event Info").Select
'ActiveSheet.Unprotect
'Track = Range("C8").Value


'copying and centering the picture in the cell
'Dim pic As Picture

'Set pic = Sheets("Event Info").Pictures(Track)

'Sheets("Event Info").Range("F22").Select

'If (pic.Height / pic.Width) >= 0.8 Then


 'With pic.Duplicate
 '.Left = ActiveCell.Left + ActiveCell.Width / 15
 '.Top = ActiveCell.Top + ActiveCell.Height / 4
 '.LockAspectRatio = msoTrue
 '.Height = 175
 'End With
  
'Else


 'With pic.Duplicate
 '.Left = ActiveCell.Left + ActiveCell.Width / 15
 '.Top = ActiveCell.Top + ActiveCell.Height / 4
 '.LockAspectRatio = msoTrue
 '.Width = 195
 'End With

'End If

'Sheets("Event Info").Range("C8").Select
'ActiveSheet.Protect
'ScreenUpdating = True

'End Sub
Sub GetPic()

ActiveSheet.Unprotect
For Each Shape In Worksheets("Event Info").Shapes
           If Not Intersect(Shape.TopLeftCell, Worksheets("Event Info").Cells(22, 6)) Is Nothing Then
                Shape.Delete
                Exit For
           End If
Next Shape
Dim fNameAndPath As Variant
Dim img As Picture
fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
    Set img = ActiveSheet.Pictures.Insert(fNameAndPath)

If (img.Height / img.Width) >= 0.65 Then

With img
 .Left = ActiveSheet.Range("F22").Left + ActiveSheet.Range("F22").Width / 15
 .Top = ActiveSheet.Range("F22").Top + ActiveSheet.Range("F22").Height / 4
 '.LockAspectRatio = msoTrue
 .Height = 172
End With
 
Else

With img
 .Left = ActiveSheet.Range("F22").Left + ActiveSheet.Range("F22").Width / 15
 .Top = ActiveSheet.Range("F22").Top + ActiveSheet.Range("F22").Height / 4
 '.LockAspectRatio = msoTrue
 .Width = 269
End With
End If

End Sub
Sub InsertTrackMap()
ScreenUpdating = False

Sheets("Event Info").Select
ActiveSheet.Unprotect
Sheets("Event Info").Range("F22:I33").CopyPicture xlScreen, xlPicture

    Sheets("D1").Select
    ActiveSheet.Unprotect
    Sheets("D1").Range("AI7").Select
    Sheets("D1").Paste
    ActiveSheet.Protect
        
    Sheets("R1").Select
    ActiveSheet.Unprotect
    Sheets("R1").Range("AK7").Select
    Sheets("R1").Paste
    ActiveSheet.Protect

    Sheets("Event Info").Select
    ActiveSheet.Protect
    ScreenUpdating = True
End Sub
