Find certain worksheets and make changes

shindig54

New Member
Joined
Dec 12, 2014
Messages
46
Hello,
I have a tab called "Control"
On the "Control" tab I have a named range called "ProjectIDs"
"ProjectIDs" has a range of abut 24 rows and contains the worksheet names that would like updated when I run the macro. However, I don't always have 24 worksheet in the range filled out. I may only have 5 worksheet that I want updated, for example.
I'd like to have vba code that will make certain updates to each of the sheet in my "ProjectIDs"list.
Is tis possible?

Thanks so much
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I have the following but doesn't work

Public Sub Test()
Dim SH As Worksheet
Dim rng As Range


Set rng = Active.Workbook.Sheets("Control").Range("ProjectIDs")
For Each SH In ActiveWorkbook.Worksheets

Range("C3").Select
ActiveCell.Formula1C1 = "5"
End If
Next SH
End Sub
Does anyone know what all I am doing wrong? Thanks to anyone willing to help.
 
Upvote 0
Try this:
Code:
Public Sub Test()

    Dim rng As Range
    Dim cell As Range
    Dim ShName As String

    Set rng = Sheets("Control").Range("ProjectIDs")
    For Each cell In rng
        ShName = cell.Value
        If ShName <> "" Then
            Sheets(ShName).Range("C3") = "5"
        End If
    Next cell
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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