+ Reply to Thread
Results 1 to 3 of 3

Create and insert picture into new worksheet with column of URLs

  1. #1
    Registered User
    Join Date
    MS-Off Ver

    Question Create and insert picture into new worksheet with column of URLs

    I'm pretty green at Macros and only started messing around with them recently, tried googling and copying stuff others have posted but cant seem to figure out what i need.

    I have URL images in column M, M2:M320. Not all cells have a URL some are blank.
    In column N i have labels for the corresponding pictures.
    I would like a macro/function/formula to read a cell in column M, if it has URL post to a second worksheet with the picture and Picture name close by/attached.

    I would prefer all the images/names to print to the single second worksheet and simply start posting lower on the worksheet as needed.
    If i can have a function built in to set the pic size to the pixels i want that would be awesome, else the actual picture size should be fine.

    I plan to start studying/reading up on Macros/VBA but would love to get this working sooner than later for a project im doing at work. Any help would be greatly appreciated!!!

    I took coding a couple years ago in school (its been a while though) and use basic excel weekly so i know enough to stumble around but by no means know what im doing :P
    Last edited by brandonk; 05-05-2016 at 04:58 PM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    North Carolina
    MS-Off Ver

    Re: Create and insert picture into new worksheet with column of URLs

    Big question: is the URL to the picture itself or a page that contains the picture? Also where are the picture names coming from?

    This isn't exactly the best project for a beginner in VBA since it involves cross-applications.

    Also, it will help a lot if you can attach a sample spreadsheet. If you have sample pictures / URLs, zip them and post them too.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    MS-Off Ver

    Re: Create and insert picture into new worksheet with column of URLs

    URL is picture itself
    Picture names are coming from another column in the spreadsheet

    Found this finally : (which works partly!! thanks andrew poulsom)
    Sub IMAGE()
    Dim Rng As Range
    Dim Cell As Range
    Dim ws As Worksheet
    Dim s As Shape
    Set ws = ActiveSheet
    Application.ScreenUpdating = False

    Set Rng = Range("n2:n" & Range("n" & Rows.Count).End(xlUp).Row)
    For Each Cell In Rng
    With Cell
    On Error Resume Next
    Set s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, 1).Left, Cell.Offset(, 1).Top, Cell.Offset(, 1).Height, Cell.Offset(, 1).Width)

    If Err <> 0 Then
    With .Offset(, 1)
    s.Top = .Top + 5
    s.Left = .Left + 5
    s.Height = 65
    s.Width = 67
    End With
    End If
    On Error GoTo 0
    End With
    Next Cell

    Application.ScreenUpdating = True
    End Sub
    This will print the first column of URLs pictures right on top/near the URL. Now just need it to read the other two columns (ideally it should read n2, o2, p2 then go to n3, o3, p3 then n4...... etc.
    And position them all an decent size at the bottom and pull the picture name from column D. (note n2, o2, p2 all have the same "picture name")

    Will keep messing around and may try to upload the file to google drive or something so i can show you guys what i have so far.

+ 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. VBA to open URLs in worksheet column, then copy and paste new URL into new column
    By diana310 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2015, 08:47 PM
  2. insert picture on worksheet to userform
    By earlcools in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-16-2014, 07:47 AM
  3. How do I lock picture that I insert in worksheet
    By jamshoot in forum Excel General
    Replies: 0
    Last Post: 07-10-2013, 09:55 AM
  4. VBA for Picture insert at particular worksheet range. Picture name derived from cell.
    By Douglas2013 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2013, 01:16 AM
  5. How to insert a picture (from same worksheet) as background in chart
    By Jacc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-17-2012, 05:39 AM
  6. Insert picture into userform from hyperlink on worksheet
    By msommerf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-16-2010, 12:21 PM
  7. [SOLVED] How can I insert a picture from file while worksheet is protected
    By ChrisYH in forum Excel General
    Replies: 0
    Last Post: 07-27-2005, 12:05 AM

Tags for this Thread


Posting Permissions

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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.06429 seconds
  • Memory Usage 8,928KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (3)postbit_legacy
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (4)showthread_bookmarksite
  • (7)showthread_similarthreadbit
  • (1)showthread_similarthreads
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (49):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • showthread_similarthread_query
  • showthread_similarthreadbit
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1