Color selected filtered rows only

Praveen Kumar82

New Member
Joined
Oct 15, 2018
Messages
2
Hi All,

I am new in excel macro and stuck while creating a sheet.
I have a excel where there are 2000 columns and i have to filter the data using column "test case name - Column D". once the filter is set then the selected rows need to colored and another column should be added in last with "ok" (in selected columns only).

I have searched the same in forum and get some help and used the code but complete sheet of getting colored instead of selected rows.

below is the full code.

Sub TestCase_Conditions()


Dim testvalue1
Dim Value1
Dim Rng1


Value1 = "tbAccFundCorrSumSoli"

With Worksheets("Analyze").Range("H:H")

Set Rng1 = .Find(What:=Value1, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)


If Not Rng1 Is Nothing Then

Call Set_Color

End If
'

End With


End Sub


Sub Set_Color()


Set CritRange = Range(ActiveCell, ActiveCell.End(xlDown))
Worksheets("Analyze").Activate
Set DataRange = Worksheets("Analyze").Range("A2:J" & Rows.Count).End(xlUp).SpecialCells(xlCellTypeVisible)
DataRange.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=CritRange




With ActiveSheet
Set filterRange = Worksheets("Analyze").Range("A2:J" & Rows.Count).End(xlUp).SpecialCells(xlCellTypeVisible)

filterRange.EntireRow.Interior.Color = 65535
End With





On Error GoTo 0


End Sub


Please help to solve this issue.

Thank you in advance.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi & welcome to MrExcel.
Rather than posting some code which doesn't work & a fairly vague description of what you want.
You'd be better of supplying more exact details. For instance
Are you filtering col D for 1 value, or various values. Also what are the value(s)?
Which col do you want to insert "OK" into and does change each time you run the macro.
 
Upvote 0
Hi & welcome to MrExcel.
Rather than posting some code which doesn't work & a fairly vague description of what you want.
You'd be better of supplying more exact details. For instance
Are you filtering col D for 1 value, or various values. Also what are the value(s)?
Which col do you want to insert "OK" into and does change each time you run the macro.

Hi,

Thank for looking into it.
But Issue has been resolved now.

Thank you.
 
Upvote 0
Glad it's sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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