+ Reply to Thread
Results 1 to 7 of 7

Entering image in to a worksheet from user form

  1. #1
    Registered User
    Join Date
    01-04-2014
    Location
    hartlepool England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Entering image in to a worksheet from user form

    HI every one

    I have a user form that uploads and image from file into an image box/frame, the form also has a couple of Combo boxes and textboxes. I am trying to save the information from the user form to a worksheet with the following code:

    Private Sub Cmdadd_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Area 1")

    'find first empty row in database
    iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

    With ws
    .Cells(iRow, 1).Value = Me.Image1.Value
    .Cells(iRow, 2).Value = Me.ComboBox1.Value
    .Cells(iRow, 3).Value = Me.ComboBox2.Value
    .Cells(iRow, 4).Value = Me.TextBox2
    .Cells(iRow, 5).Value = Me.TextBox3
    .Cells(iRow, 6).Value = Me.TextBox6
    .Cells(iRow, 9).Value = Me.TextBox4
    .Cells(iRow, 8).Value = Me.TextBox5
    End With

    End Sub

    All the information apart from the image are being moved to the worksheet. I'm not to sure what I am doing wrong.

    Thank you for your help

    Tony

  2. #2
    Forum Contributor guitarsweety's Avatar
    Join Date
    10-30-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    188

    Re: Entering image in to a worksheet from user form

    Here's something that you can maybe modify or at least send you in the right direction.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-04-2014
    Location
    hartlepool England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Entering image in to a worksheet from user form

    Thanks guitarsweety

    I am very new to VBA and can't work out where I would have to change the code, to get the information from the userform to the correct location on my worksheet.

    thanks for your help anyway

    Tony

  4. #4
    Forum Contributor guitarsweety's Avatar
    Join Date
    10-30-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    188

    Re: Entering image in to a worksheet from user form

    Can you attached your workbook?

  5. #5
    Registered User
    Join Date
    01-04-2014
    Location
    hartlepool England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Entering image in to a worksheet from user form

    HI guitarsweety

    The wookbook is to large to upload on to the site.

    thaks

    Tony

  6. #6
    Forum Contributor guitarsweety's Avatar
    Join Date
    10-30-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    188

    Re: Entering image in to a worksheet from user form

    Good luck to you, I'm afraid I'm not much help to you without seeing what you're working with

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Entering image in to a worksheet from user form

    Tony

    You can't put an image in a cell.

    If you had ActiveX image controls on the sheet you could load them with picture from the userform like this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  8. #8
    Registered User
    Join Date
    01-04-2014
    Location
    hartlepool England
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Entering image in to a worksheet from user form

    HI Norie

    I have added ActiveX image control to sheet, which worked fine with the first picture, but when trying to add another picture it is replacing the first and not moving down to the next row??

+ 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. [SOLVED] Excel vba user form- open directly to user form not worksheet
    By PANTECH in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 04-24-2013, 05:07 PM
  2. Can this be done? (Trying to change an image in a user form)
    By Fenway55 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2013, 09:37 PM
  3. Calling a user form initialize sub when entering the form to populate combobox...
    By regupnorth in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2012, 07:24 AM
  4. Image instead of message in User form
    By Tunk Ayauit in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-28-2011, 01:55 PM
  5. Entering worksheet data via user form
    By Tellus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2008, 01:37 PM

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