+ Reply to Thread
Results 1 to 5 of 5

with statement to format shape

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    with statement to format shape

    How would I optimise the following code and use "with statements", rather than selecting the shape first in order to format it? I do understand that "with statements" in VBA work faster/more efficient than the "selection" method. Though I only know how to do it with "ranges" such as:

    Please Login or Register  to view this content.
    But how would I apply that to a certain shape without selecting it first as in the example below?

    Please Login or Register  to view this content.
    I renamed the shape to "Japan" and tried to change it's colour with a "with statement" (see below), but it doesn't seem to work!

    Please Login or Register  to view this content.
    Does anyone know what I'm doing wrong?

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: with statement to format shape

    Hi,

    What you need is this
    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: with statement to format shape

    I knew there was an easy fix! Thanks!!

    How would I now add several shapes in an array? I need to change the formatting of around 10 shapes at the same time.

    Please Login or Register  to view this content.
    what am I missing in the above to make it work?
    Last edited by esbencito; 07-24-2017 at 09:57 PM.

  4. #4
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: with statement to format shape

    Never mind! Just solved it myself!

    Please Login or Register  to view this content.
    Thanks again!

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: with statement to format shape

    You're welcome, and thank you for the rep. Please remember to mark the thread Solved.

+ 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. Condtional Format a shape
    By rosshkerr in forum Excel General
    Replies: 2
    Last Post: 09-17-2015, 11:01 PM
  2. UK County map in excel shape format
    By ausrunas in forum Excel General
    Replies: 1
    Last Post: 09-11-2013, 05:00 PM
  3. format shape based on cell value
    By masoudij in forum Excel General
    Replies: 1
    Last Post: 06-29-2013, 03:38 PM
  4. How to format pasted Shape in PPoint?
    By mclarke2030 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 03:18 PM
  5. Excel 2007 : Format Shape in buttons
    By soniarun in forum Excel General
    Replies: 19
    Last Post: 06-11-2008, 05:11 AM
  6. Cell shape/format question
    By Alex01 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-17-2007, 10:06 AM
  7. Conditional Format for a Shape
    By jpendegraft in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2007, 12:47 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