ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how can I check for cell focus inside a spreadsheet ? (https://www.excelbanter.com/excel-worksheet-functions/142878-how-can-i-check-cell-focus-inside-spreadsheet.html)

EdwardAlanzo

how can I check for cell focus inside a spreadsheet ?
 
I'm trying to do some "Conditional Formatting" of a range of cells if any
cell in that range is focused on.

example, assuming I've built a payroll spreadsheet, and I'm using rows 2
though 7, (columns A through M).

A2:A7 the list of employee names
B2:B7 the emploee pay rate,
C2:C7 the number of hours the employee worked,
etc., etc until M2:M7 which shows the employees NET wages.

When I focus on any cell within a row, (click in a cell), I want to set up
conditional formatting that will effect all the cells within that row.
(Basically, if I focus in D4, I want cells A4-M4 (the entire row) to have a
solid green pattern with BOLD white text. Then, IF I click in L5, I want
A4-M4 to back to its normal formatting and row A5-M5 to assume the solid
green pattern with BOLD white text.)

Peo Sjoblom

how can I check for cell focus inside a spreadsheet ?
 
Only by using an event macro would this be possible
Personally I think it is a bad idea


--
Regards,

Peo Sjoblom



"EdwardAlanzo" wrote in message
...
I'm trying to do some "Conditional Formatting" of a range of cells if any
cell in that range is focused on.

example, assuming I've built a payroll spreadsheet, and I'm using rows 2
though 7, (columns A through M).

A2:A7 the list of employee names
B2:B7 the emploee pay rate,
C2:C7 the number of hours the employee worked,
etc., etc until M2:M7 which shows the employees NET wages.

When I focus on any cell within a row, (click in a cell), I want to set up
conditional formatting that will effect all the cells within that row.
(Basically, if I focus in D4, I want cells A4-M4 (the entire row) to have
a
solid green pattern with BOLD white text. Then, IF I click in L5, I want
A4-M4 to back to its normal formatting and row A5-M5 to assume the solid
green pattern with BOLD white text.)




Gary''s Student

how can I check for cell focus inside a spreadsheet ?
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Cells.Font.Bold = False
Cells.Font.ColorIndex = 1

Set r = Target.EntireRow

r.Interior.ColorIndex = 10
r.Font.Bold = True
r.Font.ColorIndex = 2
End Sub

Put this in the Worksheet code area, not a standard module.
--
Gary''s Student - gsnu200721


"EdwardAlanzo" wrote:

I'm trying to do some "Conditional Formatting" of a range of cells if any
cell in that range is focused on.

example, assuming I've built a payroll spreadsheet, and I'm using rows 2
though 7, (columns A through M).

A2:A7 the list of employee names
B2:B7 the emploee pay rate,
C2:C7 the number of hours the employee worked,
etc., etc until M2:M7 which shows the employees NET wages.

When I focus on any cell within a row, (click in a cell), I want to set up
conditional formatting that will effect all the cells within that row.
(Basically, if I focus in D4, I want cells A4-M4 (the entire row) to have a
solid green pattern with BOLD white text. Then, IF I click in L5, I want
A4-M4 to back to its normal formatting and row A5-M5 to assume the solid
green pattern with BOLD white text.)



All times are GMT +1. The time now is 05:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com