Results 1 to 7 of 7

Create the same named Range across multiple sheets

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Create the same named Range across multiple sheets

    Hi All Expert,

    I have been given a task to update data validation across multiple cells & worksheets. It working fine but I am really surprised why the named range only been created at the last worksheets. Based on the code, the named range "ScoreDecimal" supposed to be created in each sheets.

    It the user remove the last worksheets, the updated data will gone

    Sub test()
    Dim ws As Worksheet
    Dim i As Integer
    
        For Each ws In Sheets
        
            Application.StatusBar = "Sheets Name: " & ws.Name & "     Sheets number: " & ws.Index & "    out of Total: " & Sheets.Count
        
            On Error Resume Next
            ws.Unprotect "sb"
            ws.Unprotect "SB"
            On Error GoTo 0
               
                For i = 0 To 8
                    ws.Cells(502, "R").Offset(i).Value = 1 + i / 2
                Next i
                
                ws.Range("R502:R510").Name = "ScoreDecimal"
                ws.Range("C504").Value = "ScoreDecimal"
                            
            With ws.Range("H20").SpecialCells(xlCellTypeSameValidation).Validation
                .Delete
                .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=INDIRECT($C$504)"
                .IgnoreBlank = False
                .InCellDropdown = True
                .InputTitle = "DATA ENTRY GUIDE:"
                .ErrorTitle = "WRONG VALUE ENTERED"
                .InputMessage = "" & Chr(10) & "Assessment scores must be in absolute number between 1 to 5"
                .ErrorMessage = "Assessment scores must be between 1 to 5"
                .ShowInput = True
                .ShowError = True
            End With
            
            ws.Protect "sb"
        Next ws
        
        MsgBox "Completed", 64, "Job Done"
    End Sub
    Last edited by Faridwahidi; 09-06-2015 at 10:00 PM.
    1. Thank those who have helped you by clicking the Star * below the post.
    2. Please mark your post [SOLVED] if it has been answered satisfactorily.

    Sincerely,
    Farid

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Expanding code from working on one named sheet to multiple named sheets
    By BryanD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2014, 01:26 PM
  2. Is this possible? Create new workbook from multiple sheets based on variable range?
    By Ashaffer2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-26-2014, 08:52 AM
  3. [SOLVED] Create macro that searches multiple named ranges and returns name of the range with data
    By mechant in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2013, 01:04 AM
  4. Named range with Vlookup on Multiple Sheets
    By Spike8754 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-12-2012, 09:54 AM
  5. Cancel posting
    By Richard3 in forum Excel General
    Replies: 1
    Last Post: 02-24-2012, 12:45 PM
  6. Sumproduct across multiple sheets using named range
    By reggie1000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2008, 09:25 AM
  7. Dynamic named range across multiple sheets
    By babycody in forum Excel General
    Replies: 3
    Last Post: 07-24-2005, 02:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1