+ Reply to Thread
Results 1 to 4 of 4

Target address query

  1. #1
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Target address query

    Hello,

    I've been making some custom buttons in a worksheet using shapes and they are all working nicely for what i need them to do;however after looking at the code i thought it would be simpler to do it another way and it doesn't seem to work. So I'm curious to see if someone could explain why?

    I've got a practice set up at the moment with 4 cells, but the main one will be 12 once done.

    It cell has been named as cell title + "Bg", so for example, the cell with "workflow" in it is named "workflowBg"

    It cell then has a shape on top on it where the fill and outline are zero and is in turn called the cell title + "Btn" ( using above example that makes it "workflowBtn")

    These 4 cells in the practice sheet are then collectively named "dbButtons". I've then attached the following marco to the buttons;


    Please Login or Register  to view this content.

    It works fine. The cell pressed changes colour when clicked.

    The marco clears all the cell colours when clicked and changes just the choosen cell.

    My query is that i thought it would be better to have simply two lines; one to remove the colour from all the cells when clicked & and another to add it back to the chosen cell only. That way I would have to cycle through 12 case statements when i come to add all the other buttons.

    Would this be possible? i get a lot of error messages each time i try...

    Thanks

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Target address query

    have 2 routines, 1 clear, 1 color.
    usage:
    NoColor Range("dbButtons")
    or
    Colorize Range("bgClaims")

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-10-2009
    Location
    nottingham
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Target address query

    Hi Ranman,

    Would that work? I never considered two routines.

    I could certain have one routine to clear the colour of the whole group. I assume once complete i would have to "call" the second routine to put the colour back into the cell that was clicked only.

    I got stuck on the above code on being able to reference the clicked cell only. Do you know how i would do this at all?

    thanks

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Target address query

    Colorize activecell

+ 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. Target.Address Help
    By TSHolland in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2015, 11:26 AM
  2. [SOLVED] If Target.Address
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2012, 07:36 PM
  3. How to simplify Target.Address?
    By londonpeter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-21-2012, 04:25 PM
  4. How do you get the next Target.Address?
    By GeorgeHSmith in forum Excel General
    Replies: 1
    Last Post: 07-18-2011, 06:24 PM
  5. Target.Address help
    By gth667h in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2010, 05:54 PM
  6. Target.address
    By esullivan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2010, 09:36 AM
  7. Target Address
    By bforster1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2005, 10:21 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