Macro - Excel won't scroll down to highlighted cell

rojoe1

New Member
Joined
Aug 8, 2018
Messages
6
Hi Guys - I wrote a Macro that will highlight a cell when the contents of the cell matches the searching criteria. The macro works fine, except that if the cell being searched is in row 200, Excel won't scroll down to where the cell is. For example. I have a spreadsheet that contains 290 rows. Let's say I want to find the content of cell 250, the Macro does highlight the cell, but Excel won't scroll down to where the cell is. I have to manually scroll down in order to find the cell. Can someone please help me find out how to get around this issue. Any help will be greatly appreciated.

I'm running Excel 2016 on a Windows 10 environment. Below is the Macro code.

Sub SearchAndHighlight()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim ThisArea As Range, SearchMe As String
Sheets("Master List").Activate
SearchMe = InputBox("Write here what you're looking for.")
If IsEmpty(SearchMe) Then Exit Sub
Set ThisArea = Sheets("Master List").Cells.Find(SearchMe, lookat:=xlWhole)
If ThisArea Is Nothing Then
MsgBox SearchMe & " - " & "There is no such entry."
Else
Cells.Interior.ColorIndex = xlColorIndexNone
ThisArea.Interior.ColorIndex = 6
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi & welcome to MrExcel
How about
Code:
thisarea.Interior.ColorIndex = 6
[COLOR=#0000ff]Application.Goto thisarea, True[/COLOR]
End If
 
Upvote 0
Hi Guys - I wrote a Macro that will highlight a cell when the contents of the cell matches the searching criteria. The macro works fine, except that if the cell being searched is in row 200, Excel won't scroll down to where the cell is. For example. I have a spreadsheet that contains 290 rows. Let's say I want to find the content of cell 250, the Macro does highlight the cell, but Excel won't scroll down to where the cell is. I have to manually scroll down in order to find the cell. Can someone please help me find out how to get around this issue. Any help will be greatly appreciated.

I'm running Excel 2016 on a Windows 10 environment. Below is the Macro code.

Sub SearchAndHighlight()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim ThisArea As Range, SearchMe As String
Sheets("Master List").Activate
SearchMe = InputBox("Write here what you're looking for.")
If IsEmpty(SearchMe) Then Exit Sub
Set ThisArea = Sheets("Master List").Cells.Find(SearchMe, lookat:=xlWhole)
If ThisArea Is Nothing Then
MsgBox SearchMe & " - " & "There is no such entry."
Else
Cells.Interior.ColorIndex = xlColorIndexNone
ThisArea.Interior.ColorIndex = 6
ThisArea.Show
End If
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Does adding the red highlighted line of code above do what you want?
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,234
Messages
6,123,776
Members
449,123
Latest member
StorageQueen24

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