+ Reply to Thread
Results 1 to 6 of 6

VBA to loop through Shapes

  1. #1
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Question VBA to loop through Shapes

    Dear all,
    Please review the attachment
    I have shapes ENG CHK and PR CHK in the order shown.

    Is it possible to loop through these shapes using VBA and check if any of the shapes in PR CHK has "OK" in it and any shapes among ENG CHK has "YES" in it..?

    To reduce complexity, ENG CHK shape names vary from Rectangle 1 to Rectangle 20 and PR CHK shapes vary from Rectangle 21 to Rectangle 40

    I am looking for something like this (Roughly):


    For i=1 to 20
    If shape.name(i)="YES" then
    Msgbox "YES - found"
    End if
    For i=21 to 40
    If shape.name(i)="OK" then
    Msgbox "OK- found"
    End if

    I never did looping through shapes till now...Please help and i will seriously try my best to understand the logic..

    Many Thanks..
    Attached Files Attached Files

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to loop through Shapes

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Unhappy Re: VBA to loop through Shapes

    Hey, Thanks for your response.
    Your code throws an error..Tried fixing it, but couldn't succeed...
    Please refer attachment..
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: VBA to loop through Shapes

    Hi mchilapur,

    Change this line of Mick's code...

    Please Login or Register  to view this content.
    ...to this:

    Please Login or Register  to view this content.
    Please also wrap your code with the appropriate tags as Mick and I have done.

    Thanks,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  5. #5
    Forum Contributor
    Join Date
    09-20-2014
    Location
    India
    MS-Off Ver
    2013
    Posts
    275

    Re: VBA to loop through Shapes

    Works great...Thanks a lot...

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: VBA to loop through Shapes

    Please you got it sorted
    Regrds Mick

+ 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] Move Shapes - Loop through all WS not working
    By Janc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2015, 08:51 AM
  2. [SOLVED] loop through shapes ?
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2014, 08:11 AM
  3. [SOLVED] Move Two Shapes In The Same Loop
    By primed in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2014, 08:03 AM
  4. Help with loop to fill color of shapes (US map)
    By harleyberger in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2012, 01:50 PM
  5. How To Move Shapes From Another Shapes? (floating shapes)
    By MarcLev in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2009, 04:04 PM
  6. Loop through shapes and alter interior color
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2009, 08:33 AM
  7. Replies: 1
    Last Post: 04-13-2006, 07:30 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