Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Interior borders Nicole Excel Discussion (Misc queries) 5 October 17th 05 10:21 PM
Selection.Interior.ColorIndex = 0 Error [email protected] Excel Programming 3 September 28th 05 11:36 PM
RGB value of cell interior Brotha lee Excel Programming 8 May 20th 05 12:47 AM
Code to change interior colour only if current interior colour is BeSmart Excel Programming 2 October 5th 04 12:06 AM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"