Highlighting row when selecting data data via vba

BIGTONE559

Active Member
Joined
Apr 20, 2011
Messages
336
Greetings,

i'm trying to figure out how to highlight a row, and also increase font size of a row where the active cell is. It would also be nice if this macro ran once the file was opened as well.

Data will be in the following range:

B10:O45

i.e. if cell d10 is selected Range(Cells(2,10),Cells(15,10) would be highlighted in yellow with D10 slightly larger than the other cells.

Is this possible? also would be nice if the font of the entire row was bold.


Regards!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Select the range. Format > Conditional Formatting, use Formula Is with the formula

=ROW()=CELL("row")

and apply your formatting. Then right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = True
End Sub
 
Upvote 0
VOG

is there a way to increase the font size of that particular row?

is there also a way to bold that row?

the above code worked wonderfully by the way
 
Upvote 0
You can use Bold in the CF options. You cannot change font size in conditional formatting.
 
Upvote 0
Duh your absolutely right Vog. . . been a long work week.


I have noticed that it apears the screen refreshes no matter where the active cell goes. It would be really nice if the code was limited to


Range("B10:O45") and when the active cell was outside of this range. the screen would no longer update.

Any ideas?
 
Upvote 0
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B10:O45")) Is Nothing Then Application.ScreenUpdating = True
End Sub
 
Upvote 0
Wonderful that was great. . . now i noticed the code you gave me required me to apply it to the respective sheet.

Could i apply the code to Thisworkbook and Exclude Sheets?

i have a total of 17 sheets however, 12 of them would be subject to this code. . .
 
Upvote 0
Try like this in the ThisWorkbook module

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Not IsNumeric(Application.Match(Sh.Name, Array("Sheet1", "Sheet5", "Data"), 0)) Then ' list of sheets to exclude
    If Not Intersect(Target, Range("B10:O45")) Is Nothing Then Application.ScreenUpdating = True
End If
End Sub
 
Upvote 0
I've noticed that since i've updated the file with the aforementioned code, That the screen updates even when i run macro that specifies the screen to not update. What is the solution for this issue?
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,813
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top