+ Reply to Thread
Results 1 to 12 of 12

Copy selected rows data and pictures to another worksheet

  1. #1
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Copy selected rows data and pictures to another worksheet

    I am using ms excel 2013. Be aware, I have limited programming knowledge, but welcome any help that can move me forward on my project. I would like to copy a selected row of data, including an associated picture to another worksheet. In sheet1, I am using a checkbox to select a row containing data and an associated picture, and have created a "copy exercises" button on sheet 1 as well. The code is included below. Although the data copies correctly to sheet2 the picture does not. Apparently, I missing something and only the data is copied. Is their a solution to copy the selected row data including the picture to sheet 2?

    Sub CopyExercises()

    For Each chkbx In ActiveSheet.CheckBoxes
    If chkbx.Value = 1 Then
    For r = 1 To Rows.Count
    If Cells(r, 1).Top = chkbx.Top Then
    With Worksheets("ClientExerciseList")
    LRow = .Range("A" & Rows.Count).End(xlUp).Row + 1
    .Range("A" & LRow & ":I" & LRow) = _
    Worksheets("ExerciseInventory").Range("A" & r & ":I" & r).Value
    End With
    Exit For
    End If
    Next r
    End If
    Next

    End Sub

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    Hi Piranhao,

    Welcome to the Forum!

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    BTW - Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: Copy selected rows data and pictures to another worksheet

    Thank you for your help and instructions. I have uploaded a workbook using the "Go Advanced" tab as suggested. In the sample workbook, after selecting the row to copy on sheet1, and pressing the macro "copy exercise" button, the data copies to sheet2 but, the images do not. Is their additional VBA to copy both the data and images at simultaneously? Thank you!
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    Hi Piranhao,

    This works

    Please Login or Register  to view this content.
    Last edited by xladept; 08-22-2015 at 02:39 PM.

  5. #5
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: Copy selected rows data and pictures to another worksheet

    Thanks so much; it works like a charm!

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    You're welcome and thanks for the rep!

  7. #7
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: Copy selected rows data and pictures to another worksheet

    Your welcome!
    Referencing "project7" file upload. Using the checkbox to select row2; What if I only require specific cells from sheet1, row2, (for example B2,H2 and I2), to copy to sheet2? Additionally, is their VBA to "deselect" or remove the data and images from sheet2 once copied? thank you

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    Hi Piranhao,

    These may be what you want:

    Please Login or Register  to view this content.
    For the clear you'll need to have the row selected.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: Copy selected rows data and pictures to another worksheet

    my apologies for not responding to your post sooner; thank you for your continuing help with my database. I have used the above code and although it does copy the specific data from each selected row, it seems to be copying each row to only one row in the clientdexerciselist sheet. Additionally, I assume I need another macro button to clear the row selected...is that correct? Please reference the attached worksheet. Thank you for your patience an help once again.
    Attached Files Attached Files

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    Hi Piranhao,

    I had to change the code:Piranhao2.xlsm

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    * You also need to make the change highlighted in red
    Last edited by xladept; 09-15-2015 at 03:27 PM.

  11. #11
    Registered User
    Join Date
    08-15-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    6

    Re: Copy selected rows data and pictures to another worksheet

    Thanks much for your help; if I could I would give you + rep feedback again

  12. #12
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Copy selected rows data and pictures to another worksheet

    Hi Piranhao,

    You're welcome!

    (I didn't realize that you couldn't rep me again, I get reps from the same OP fairly often)

+ 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. Copy selected rows and place them into a new worksheet.
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2014, 08:40 AM
  2. Copy selected rows to another worksheet
    By Val Matthews in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 01:47 PM
  3. Replies: 0
    Last Post: 08-10-2012, 03:09 AM
  4. Copy selected cells/rows to another worksheet _
    By mcm1009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2011, 11:34 AM
  5. Copy selected cells/rows to another worksheet
    By Spellbound in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-07-2011, 01:02 PM
  6. Copy Selected Cells of Rows to another Worksheet Based on a Condition
    By Al53 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2010, 10:33 PM
  7. Copy selected rows into new worksheet
    By nes83 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2005, 09:58 AM

Tags for this Thread

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