+ Reply to Thread
Results 1 to 18 of 18

How to move picture one cell left?

  1. #1
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    How to move picture one cell left?

    My expected result is:
    1. A picture is selected manually
    (e.g. picture with left top corner at L3)
    2. The picture can move to K3 by VBA.
    (NB. Width of Column K may be varied time to time)

    Enclosed with excel for reference.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: How to move picture one cell left?

    this will move the selection to the left 1 column

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    Thanks Andy Pope.

    How to advise VBA to suit my actual case as follows:

    1. Active cell is at say L3.
    2. By VBA, picture at location of cell (L3) is selected.
    3. By VBA, the picture will move horizontally to column B (B3).

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to move picture one cell left?

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture to column B?

    Hobson,

    The VBA cannot work.
    Enclosed with excel for your testing.
    Attached Files Attached Files

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to move picture to column B?

    I don't know what can not work means. I already tested it. It worked exactly as you wanted in #3. It moves the selected picture object to column B, topleft. The 2nd attachment is the same and works as well.

    Your object has a border so your perception of edges may not be what they actually are.

  7. #7
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    Hobson,

    It's work if I manually select picture at L3 first.

    How to revise VBA if:
    1. The activecell moves to say L3 manually.
    2. The picture at activecell (L3) is selected by VBA.
    3. The rest is same as your original VBA.

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to move picture one cell left?

    Manually selecting the picture object is what you said that you wanted in #1 and #3.

    If you want a cell selection worksheet event then right click your worksheet's tab, View > Code, and paste this. This solution also meets the needs of your other similar post. Just change L3 to your range address in the Intersect line.

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    Hobson,

    I don't know how to function this type of VBA with "Private".

    I have copied all code by right click the worksheet's tab (Sheet 1) and View Code (V)
    as per attached excel.

    However when I press ALT-F8, there is no Macro and hence I can't set shortcut key.

    Please advise.
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to move picture one cell left?

    Hi london7871,
    1st no picture topleftcell at L3. It is loacated at L2.
    You can try to amend Mr. Kenneth Hobson expert the codes as below:

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    ikboy,

    1. How to set shortcut key to the amended VBA?
    (if ALT-F8 and then (E) are pressed, there is above VBA code but there is no Macro name if press ALT-F8)
    2. How to revise above so that the picture at activecell (L2) can be selected by VBA?
    (i.e. if activecell moves to say L59, picture at L59 can be selected by VBA)
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: How to move picture one cell left?

    london7871,
    1. Just follow the steps how you copy the codes to (sheet 1)... I have copied all code by right click the worksheet's tab (Sheet 1) and...
    2. VBA can find pictures and let you go to the topledtcell of each. Please note "move" and "goto" are very difference meaning in VB.

  13. #13
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    ikboy,

    1.How to set shortcut key for your VBA?
    (I don't want it starts automatically)

    2. How to revise VBA if I move cell manually to another cell (say L59), picture at that cell (L59) can be selected by VBA and move to col B?
    Last edited by london7871; 07-18-2016 at 06:31 AM.

  14. #14
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to move picture one cell left?

    Try to stay on the topic. IF you need to ask an urelated question, post another thread. e.g. How to set a hotkey to play a macro. A simple search will find many link for how to do that. https://support.office.com/en-us/art...4-99a49f1dcdf4

    Try to understand concepts so that you can modify code. I already explained how to change the Intersect() code line to suit.

    Delete the worksheet code from earlier, and paste this to a Module.

    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    How to revise VBA if the pictures may not at Col L, may be at another column instead.

  16. #16
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How to move picture one cell left?

    You don't know how to change "L" to "P" or "Q" or....?

    From my last post:
    Try to understand concepts so that you can modify code. I already explained how to change the Intersect() code line to suit.
    Press F1 with cursor in or next to a command word like Intersect() if you need help.
    Last edited by Kenneth Hobson; 07-18-2016 at 11:51 AM.

  17. #17
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    I want to cover all pictures in columns L to P as the location of pictures may be changed each time.

    [Original query to be deleted :
    I want to set to say P or Q etc. by VBA according to actual location of pictures.]
    Last edited by london7871; 07-19-2016 at 12:15 AM. Reason: Range changes from "P or Q" to "L to Q"

  18. #18
    Forum Contributor
    Join Date
    09-18-2011
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    375

    Re: How to move picture one cell left?

    Thanks Hobson,
    The VBA works if the code is revised as follows:
    Set r = Intersect(ActiveCell, Columns("L:P"))

    Also thanks to ikboy and Andy Pope for help.

+ 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. How to move the selected picture to specified cell?
    By london7871 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2016, 11:51 PM
  2. If cell = 1, move 3 cells to the left
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2015, 01:09 PM
  3. [SOLVED] VBA help to move and resize a picture from one cell to another
    By markharris2004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2013, 07:04 AM
  4. Need to move data from cell to the left
    By eddielong in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-01-2011, 11:10 AM
  5. move everything before the left parenthesis into Cell B,
    By jimdavidson in forum Excel General
    Replies: 5
    Last Post: 05-06-2008, 03:05 PM
  6. Move a Picture to cell C1
    By Bill (Unique as my name) in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2006, 12:25 PM
  7. [SOLVED] HOW TO: Move a picture to the top left or top right of a cell via
    By Kevin McCartney in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2006, 12:50 PM

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