Results 1 to 6 of 6

VBA to match in a loop and use the match

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    VBA to match in a loop and use the match

    So the best way to explain this, is I have a formula that outputs the headers of various columns (basically checking for discrepancies). The entire sheet is locked for editing. When one of the cells in this helper column are equivalent to a header, I'd like the code to unlock that entire column, minus the header and anything above it. The difficult part is that I don't know which "column" will be displayed in my helper column when I run the code.

    My Headers are in row 5, and I'd like them + anything above it to remain locked. It should only display one header at a time, but it will probably be in multiple locations at once.

    I've attempted this for quite a while, but am really scratching my head on it...

    you can match it with "* column" but that's about as far as I've gotten. I can't figure out how to go from the * to a specific column. It is beyond my level at the moment (just starting VBA).

    I'll attach a sample file (no formulas, just to give you an idea of the layout).

    EDIT:
    An idea just came to me (not sure how efficient it is). We could possibly filter by the helper column by "* column" then match the visible data with a header column. I know how to do it in words, but VBA is a totally different story.

    This is what I have so far on that...

    Sub test()
    
    Dim pwd As String
    Dim criteria As String
    
    Range("A5:J5").AutoFilter
        ActiveSheet.Range("$A$5:$J$19").AutoFilter Field:=10, Criteria1:= _
            "=* column", Operator:=xlAnd
    
    pwd = ""
    criteria = ActiveSheet.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible) _
        .Cells(1, 2)
    
      For Each c In Worksheets("Sheet1").Range("A5:I5").Cells
        'code that tests for match then unlocks the range below header
      Next
    End Sub
    Any help greatly appreciated, especially if you explain the code so I can learn from it.
    Attached Files Attached Files
    Last edited by TheN; 11-18-2016 at 06:23 PM. Reason: More info on an idea

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sort by helper column even if values in helper are alike
    By NoSleepForMe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-10-2016, 04:14 AM
  2. Helper column to only show name
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2015, 08:52 AM
  3. [SOLVED] Week No. Vs.Value without Helper cells in Column E
    By thilag in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-12-2013, 04:31 AM
  4. Editing all the cells in a column
    By eileen2006 in forum Excel General
    Replies: 2
    Last Post: 08-28-2008, 10:26 PM
  5. help creating helper column
    By Allen Clark in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 12:20 AM
  6. Disallow File Save if No Input in Cells?
    By Dan Raab in forum Excel General
    Replies: 2
    Last Post: 01-09-2006, 02:40 PM
  7. [SOLVED] What is a helper column?
    By RMPPOD in forum Excel General
    Replies: 3
    Last Post: 01-28-2005, 04:06 PM

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