Need Help Hiding Duplicate Rows Based on Data VBA

sax2play

New Member
Joined
Mar 13, 2021
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
Good Morning All!

I am trying to create a macro that will hide rows in a worksheet based on value. The column (A) has both text and words. The words should remain all the time. I only want to hide the rows of duplicate numbers in that column. Any time I try to hide duplicates, I end up hiding the words as well. Any thoughts??

Thanks!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,910
Office Version
  1. 365
Platform
  1. Windows
I am having a hard time visualing what you want based on your description. Perhaps it would be clearer if you could show us a sample of what your data currently looks like, and what you would like your result to look like.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 

sax2play

New Member
Joined
Mar 13, 2021
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
Sorry for lack of info! I ended up doing this:

VBA Code:
Dim cell As Range
    For Each cell In Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row)
        If InStr(cell.Text, "Not Found") > 0 Then
            cell.Offset(0, -1) = cell.Text
            cell.ClearContents
        End If
    Next cell

Then I hid duplicates in column of numbers
 

Watch MrExcel Video

Forum statistics

Threads
1,129,285
Messages
5,635,312
Members
416,852
Latest member
kanaikls

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
Top