+ Reply to Thread
Results 1 to 5 of 5

Managing pictures in excel

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-14-2007
    MS-Off Ver
    Excel 2021
    Posts
    121

    Managing pictures in excel

    I setup a spreadsheet to track the biggest intraday gainers in the stock market. A screenshot of the biggest intraday gainers are stored in Column B but the chart is only displayed when a cell in Column B is selected. For instance in the first picture Cell C2 is selected so no picture is displayed but in the next picture B2 is selected so the chart for GNPX is displayed. I attached the code I used to get this desired functionality. I am very quickly able to switch between reviewing the intraday data and looking at the intraday chart.

    The problem is after 500 rows of data (and corresponding intraday charts) the spreadsheet is becoming sluggish when opening and saving. Is there a better way to manage all the pictures in the spreadsheet to keep it running snappy?

    Untitled3.png

    Untitled4.png


    Sub addpictest()
    
      Dim pic_file As String
      Dim pict_name As String
      Dim pict1 As Picture
     
      If ActiveCell.Comment Is Nothing Then ActiveCell.AddComment
      pic_file = Application.GetOpenFilename("PNG (*.PNG), *.PNG", Title:="Pls open a picture file:")
    
      Set pict1 = ActiveSheet.Pictures.Insert(pic_file)
      pict_name = pict1.Name
     
     
      On Error Resume Next
     
      With ActiveCell.Comment.Shape
       .Fill.Visible = msoTrue
       .Fill.ForeColor.RGB = RGB(255, 255, 255)
       .Fill.BackColor.SchemeColor = 80
       .Fill.UserPicture (pic_file)
       .Height = 725
       .Width = 1921
       
    Dim xComment As Comment
    
    For Each xComment In ActiveSheet.Comments
       xComment.Shape.Placement = xlMove
    Next
    
      End With
        
      pict1.Delete
      Set pict1 = Nothing
      ActiveCell.Comment.Visible = False
     
     
    End Sub
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     'www.contextures.com/xlcomments03.html
     Dim rng As Range
     Dim cTop As Long
     Dim cWidth As Long
     Dim cmt As Comment
     Dim sh As Shape
    Application.DisplayCommentIndicator _
          = xlCommentIndicatorOnly
    Set rng = ActiveWindow.VisibleRange
    cTop = rng.Top + rng.Height / 2
    cWidth = rng.Left + rng.Width / 2
    If ActiveCell.Comment Is Nothing Then
      'do nothing
    Else
       Set cmt = ActiveCell.Comment
       Set sh = cmt.Shape
       sh.Top = cTop - sh.Height / 2
       sh.Left = cWidth - sh.Width / 2
       cmt.Visible = True
    End If
    End Sub
    Last edited by impala096; 03-24-2023 at 01:05 PM.

  2. #2
    Forum Contributor
    Join Date
    10-14-2007
    MS-Off Ver
    Excel 2021
    Posts
    121

    Re: Managing pictures in excel

    I tried using the "IMAGE" function so excel will display the chart inside the cell based on a picture URL. This works but now the picture is a tiny thumbnail picture and I have no idea to how to expand the picture to full screen when selecting the cell.

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2505
    Posts
    13,766

    Re: Managing pictures in excel

    impala096

    Your forum profile needs to show the Excel PRODUCT that you need this request to work with.

    The best solutions often rely on knowing WHICH Office PRODUCT (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date. If you aren't sure, in Excel go to File/Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent Excel PRODUCTS are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the Version number in your profile (e.g. MS365 (PC) Version 2211). The version number is in the About Excel section further down the Account page.

    Also please post an Excel workbook sample not a screen shot or pic. Please see instructions in the 'gold' banner at the top of the page.
    Last edited by FlameRetired; 03-24-2023 at 03:40 PM.
    Dave

  4. #4
    Forum Contributor
    Join Date
    10-14-2007
    MS-Off Ver
    Excel 2021
    Posts
    121

    Re: Managing pictures in excel

    This is the software version I am on:
    Microsoft® Excel® for Microsoft 365 MSO (Version 2302 Build 16.0.16130.20298) 64-bit

  5. #5
    Forum Contributor
    Join Date
    10-14-2007
    MS-Off Ver
    Excel 2021
    Posts
    121

    Re: Managing pictures in excel

    I have a simple question. If I use 500 hyperlinks and then use the "IMAGE" command to display the images in a column of cells, would that file take up the same amount of space as if I just saved the images directly to the spreadsheet?

    I'm basically looking for a way to have hundreds of images that can be quickly displayed within excel (ie. not just clicking on a hyperlink and being taken to a page outside of excel) while keeping the excel file size small. Any suggestions?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Managing worksheets in excel
    By sunboy in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-24-2020, 02:34 AM
  2. Replies: 3
    Last Post: 01-19-2018, 09:17 AM
  3. How to remove hyperlink to pictures in excel and retain the pictures?
    By london7871 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2016, 11:24 PM
  4. Managing expenses with excel
    By dmcky in forum Excel General
    Replies: 5
    Last Post: 11-30-2013, 05:51 PM
  5. PDF managing from Excel macro
    By DGL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:14 AM
  6. Managing Excel from VB^
    By Uwe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2006, 02:45 PM
  7. Replies: 1
    Last Post: 01-29-2006, 02:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1