![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 21
|
I HAVE PLACED A BUTTON ON MY SPREADSHEET CALLED SHADE
EACH TIME THE BUTTON IS PRESSED I WOULD LIKE TO SHADE A CELL IN ROW 1 STARTING AT B1 AND AFTER EACH CLICK SHADE THE NEXT CELL IE C1,D1 ETC IS THIS POSSIBLE AND HOW WOULD I DO IT? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
YES THIS IS POSSIBLE. HAVE YOU CREATED ANY CODE TO CHANGE THE FIRST CELL? WHAT COLOUR WOULD YOU LIKE IT TO BE?
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 21
|
NO I DO NOT KNOW WHERE TO START.
THE COLOUR I AM USING IS BLUE. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Central Florida, USA
Posts: 7,541
|
I use this code as a highlighter. Select a cell once and it is colored, re-select it and it is un-colored. You can select as many cells as you want. To color a whole row just select the row header number! You must select out of the current selection then re-select the colored selection to turn off the highlight. The code works on the "View sheet code" page. You do not need a form button to work this it is automatic. Hope this helps. JSW
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Not Intersect(Target, Selection) Is Nothing Then If Target.Interior.ColorIndex = 34 Then Target.Interior.ColorIndex = 0 Else Target.Interior.ColorIndex = 34 End If End If End Sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|