selection.interior
Ok, I'm totally new to VBA but am learning fast. I created two macros. One
that simply colors certain text and cells white - so they dont print. And then another that changes the text back to black and then highlights a few cells. They're basically my show/hide buttons for text I dont want to print. However, whenever I run the macro it hangs up on the last line of the macro "selection.interior.colorindex = x". Also, will this macro run on all platforms? Is there something I need to know about VBA for Excel on a Mac versus PC? Sub Hide_Text() Range("g11:k61").Select Selection.Font.ColorIndex = 2 Range("g12:g61,a12:e61,l8").Select Selection.Interior.ColorIndex = 2 End Sub Sub Show_Text() Range("a11:m11,g11:k61").Select Selection.Font.ColorIndex = 0 Range("g12:g61,b12:e61,l8").Select Selection.Interior.ColorIndex = 19 End Sub |
selection.interior
Hello Eric , The problem is with your range assignment... Range("g12:g61,a12:e61,l8").Select This type of Range statement can only accept 2 arguments separated by comma. Range("G12:G61", "A12:E61").Select This will select A12 as the Top Left cell in the Range and G61 as th Lower Right in the Range rectangle . Before I go on, it would help to know how you want the cells selected As 3 separate Ranges or what? Let me know. Thanks, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48092 |
selection.interior
What I'm trying to do is create two buttons: Show Text/Hide Text.
The Show Text button turns the text in the ranges black and then turns the interiors of that selection yellow - to highlight where the user should input data. The Hide Text button then turns both the text and interiors white so they dont print. There are two separate ranges I need to effect. Though I'd like the option to include other ranges at a later date. As it works now I have to manually select the ranges and do the hide/show... it'd save some headaches to be able to assign this to a button, since the ranges are fixed. "Leith Ross" wrote: Hello Eric , The problem is with your range assignment... Range("g12:g61,a12:e61,l8").Select This type of Range statement can only accept 2 arguments separated by a comma. Range("G12:G61", "A12:E61").Select This will select A12 as the Top Left cell in the Range and G61 as the Lower Right in the Range rectangle . Before I go on, it would help to know how you want the cells selected. As 3 separate Ranges or what? Let me know. Thanks, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=480929 |
All times are GMT +1. The time now is 08:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com