Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Writing and erasing code with code

I want to change the color of the active row in a spreadsheet to make
it easier to read. I have the code that accomplishes this task but I
want it to work more like an excel option rather than put it on
individual workbooks. Is there a way to insert the code I want when the
workbook opens then delete when the workbook is closed.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Writing and erasing code with code

Why not just place your code in your personal.xls workbook or by creating an
Addin. Writing and erasing code with code is a bit tricky unless you are
reasonably adept with VBA...
--
HTH...

Jim Thomlinson


"bobbo" wrote:

I want to change the color of the active row in a spreadsheet to make
it easier to read. I have the code that accomplishes this task but I
want it to work more like an excel option rather than put it on
individual workbooks. Is there a way to insert the code I want when the
workbook opens then delete when the workbook is closed.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Writing and erasing code with code


bobbo wrote:
I want to change the color of the active row in a spreadsheet to make
it easier to read. I have the code that accomplishes this task but I
want it to work more like an excel option rather than put it on
individual workbooks. Is there a way to insert the code I want when the
workbook opens then delete when the workbook is closed.


Yes, but only by code that lives in the workbook. There is no
ExcelOpen() event that will work when any workbook is open. Any code
that you write to write and delete code would be much more complex than
code to change the color of the active row, so I don't see the
motivation. You could create a registry key that serves as a flag. In
the workbooks that you want to have this functionality, in the
selection-change event check the key and depending on its value color
the active row (and, turn off the color of the previous row - stored in
a publc variable perhaps). Also include a short macro to toggle the
value of the key.

Just an idea

-John Coleman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Writing and erasing code with code

Interesting - I wasn't aware of application level events. It is still
true that such code must reside in *some* workbook and thus does not
reside persistently in the application itself - but you can put it into
an Add-in or Personal.xls and have something functionally equivalent to
an ExcelOpen() event which can apply to all workbooks. Thanks for the
info and the link to Pearson's site.

Dave Peterson wrote:
Maybe you can move your code into an application level event.

Chip Pearson has a bunch of notes for application events:
http://www.cpearson.com/excel/AppEvent.htm

Or you may want to just use Chip's RowLiner addin:
http://www.cpearson.com/excel/RowLiner.htm

bobbo wrote:

I want to change the color of the active row in a spreadsheet to make
it easier to read. I have the code that accomplishes this task but I
want it to work more like an excel option rather than put it on
individual workbooks. Is there a way to insert the code I want when the
workbook opens then delete when the workbook is closed.


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Writing and erasing code with code

Thanks for all your help. I found Chip Pearsons site while researching
this problem and found the method to write code with code. I will have
to look at the application level events info.

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
IS IT POSSIBLE IN EXCEL WITHOUT WRITING CODE. HARSHAWARDHAN. S .SHASTRI[_2_] Excel Worksheet Functions 14 February 4th 09 04:48 PM
Need help writing Code LeAnne Excel Discussion (Misc queries) 1 February 15th 08 03:27 PM
Code Erasing Cell Contents Inappropriately Paige Excel Programming 2 March 7th 06 05:51 PM
Need some help writing code. Erik[_6_] Excel Programming 5 February 29th 04 06:51 PM
Writing a formula in code Tom Ogilvy Excel Programming 0 September 5th 03 02:32 PM


All times are GMT +1. The time now is 01:18 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"