Results 1 to 3 of 3

Combine code in VBA

Threaded View

clifton1230 Combine code in VBA 03-15-2013, 11:28 PM
Norie Re: Combine code in VBA 03-15-2013, 11:38 PM
clifton1230 Re: Combine code in VBA 03-16-2013, 12:21 AM
  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    17

    Combine code in VBA

    Here's my code, how can I simplify it? I'm checking the values in a range of 4 cells against a single cell, then unprotecting two adjacent cells on each row if the value is true.

        Sheets("Quarterly Bonus").Select
        For Each cell In Range("B15")
        If Range("B15") = Range("f10") Then
        Range("D15:E15").Select
        Selection.Locked = False
        End If
        Next
        
        For Each cell In Range("B16")
        If Range("B16") = Range("f10") Then
        Range("D16:E16").Select
        Selection.Locked = False
        End If
        Next
        
        For Each cell In Range("B17")
        If Range("B17") = Range("f10") Then
        Range("D17:E17").Select
        Selection.Locked = False
        End If
        Next
    
        For Each cell In Range("B18")
        If Range("B18") = Range("f10") Then
        Range("D18:E18").Select
        Selection.Locked = False
        End If
        Next
    Last edited by clifton1230; 03-16-2013 at 12:20 AM.

Thread Information

Users Browsing this Thread

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

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