how should this line of code be written/structured?

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
476
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
PURPOSE:
If a specfic checkbox on a userform is checked, then it needs to look in a specific cell for a specific string on a worksheet and if found, then that row is to remain visible, and if not then then that row is to be hidden.

MY PROBLEM:
The range that it is to be searching in has already been previously filtered down on the worksheet (so I need it to be searching in only the visible rows in column "R".)
Additionally, it has to be looking for part of a string using the "Like" operator. Here is what I have so far (that obviously, doesn't even come close to working... I know that. But it does include everything that I want it to do so hopefully someone can help me with what is the correct way to have it structured or written so that it does what I am wanting it to do... of course may not be possible to do this or I am using the wrong approach to get what I am trying to get)

Once confirming that the checkbox is checked, AND the part of the string that it is searching for (which for this checkbox is: "*CSR2B *") in the cell 18 over (column R) and down to the last visible row, then that row is to remain visible and if not, then it is to be hidden.

Code:
If Me.chkCSR2B = True And Worksheets("Seatex Incident Log").Range(Cells(18, 18), Cells(rCol, 18)).SpecialCells(xlCellTypeVisible) Like "*CSR2B*" Then EntireRow = Visible Else EntireRow = Hidden
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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