Find & Replace Text for Hidden Tabs

mflatt23

New Member
Joined
Jun 2, 2015
Messages
20
I've got an investing checklist workbook with over 150 companies, each on a separate worksheet. Within each worksheet, there is a question "Is the FCF Yield ≥ 4%?" I'd like to update this text to instead say something different ("Is the FCF Yield ≥ its 10-year median?"). However, from what I'm seeing, I can only make this update using find & replace on unhidden worksheets. I think my computer would significantly slow down or crash if I had to unhide 150+ worksheets to update this question. Is there another way to accomplish this task? Perhaps using VBA Code?

Here is a link to a visual of my spreadsheet (cell B35):

Thanks for any help!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Your question is a little vague as to the specifics of where the text that you want to change is located on the 150+ sheets. However, the generic code below will place the text in the code in every sheet (Cell A1), whether the sheet is hidden or not...

VBA Code:
Sub TextinHidden()

    Dim wb As Workbook: Set wb = ThisWorkbook
    Dim i As Long
    
    For i = 1 To wb.Worksheets.Count
        wb.Worksheets.Item(i).Range("A1") = "I am new text"
    Next
    
End Sub
 
Upvote 0
Good point! So it's on cell B35 for every worksheet, except for about 10 financials that don't have that question. It sounds like I could just apply this code to the entire workbook and then go in and manually update the text for those 10 financials, though? Thank you so much!
 
Upvote 0
You're welcome. Another logic path to think about is, instead of manually updating those sheets, include code that will skip those sheets in the For/Next loop. Worse case, is you could hard code the names of the sheets right in the code. Best case, is that the names or some facet of the sheets share a commonality that the code could look for to skip them during the loop.
 
Upvote 0
I don't mind doing the manual sheet names. Would it be something like:

If sh.Name <> "IgnoreThisSheet" Then

Been a little while since I've done the skip logic, feel like I might be missing something...lol

Really appreciate it!
 
Upvote 0
How about something like this. Put the sheet names you want to skip in this statement

VBA Code:
Case Is = "Sheet1", "Sheet2", "Sheet3"

VBA Code:
Sub TextinHidden()

    Dim wb As Workbook: Set wb = ThisWorkbook
    Dim i As Long

        For i = 1 To wb.Worksheets.Count
            Select Case wb.Worksheets(i).Name
                Case Is = "Sheet1", "Sheet2", "Sheet3"
                Case Else
                    wb.Worksheets.Item(i).Range("B35") = "I am new text"
            End Select
        Next
    
End Sub
 
Upvote 0
I was happy to help. Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,027
Members
449,414
Latest member
sameri

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