Code only works from row 11???

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,046
I want this code to work from row 1 not 11 and also to happen as soon as text is pasted in cell A1...any ideas ?

Private Sub Worksheet_selectionChange(ByVal Target As Excel.Range)

Dim LR As Long, i As Long
If Target.Address(False, False) = "A1" Then
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With Range("A1" & i)
If .Font.Bold = True Then
.Resize(, 2).Interior.ColorIndex = 15
.Resize(, 2).Font.ColorIndex = 0
Else
.Resize(, 2).Interior.ColorIndex = xlNone
.Resize(, 2).Font.ColorIndex = 0
End If
End With
Next i
End If



End Sub



Many thanks
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You want the Worksheet_Change event, not the SelectionChange event.
 
Upvote 0
For your stated problem, remove the 1 from here.
Code:
With Range("A1" & i)
 
Upvote 0

Forum statistics

Threads
1,207,109
Messages
6,076,596
Members
446,215
Latest member
userds5593

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