Results 1 to 15 of 15

InStr()/Select Case [Excel VBA 2010]

Threaded View

lloydgodin InStr()/Select Case [Excel... 10-08-2012, 12:29 PM
JosephP Re: InStr()/Select Case... 10-08-2012, 01:07 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 01:16 PM
JosephP Re: InStr()/Select Case... 10-08-2012, 01:19 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 01:22 PM
JosephP Re: InStr()/Select Case... 10-08-2012, 01:31 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 04:43 PM
shg Re: InStr()/Select Case... 10-08-2012, 05:15 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 05:37 PM
shg Re: InStr()/Select Case... 10-08-2012, 05:55 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 06:08 PM
shg Re: InStr()/Select Case... 10-08-2012, 06:42 PM
lloydgodin Re: InStr()/Select Case... 10-08-2012, 06:47 PM
shg Re: InStr()/Select Case... 10-09-2012, 10:37 AM
lloydgodin Re: InStr()/Select Case... 10-09-2012, 12:59 PM
  1. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: InStr()/Select Case [Excel VBA 2010]

    Create a worksheet named Ref in the add-in, add your data there as Joseph suggested, add a named range to reference it, and put this code (modestly adapted from Joseph's, and completly untested) in the add-in:

    Sub lg()
        Dim vData       As Variant
        Dim n           As Long
        Dim sName       As String
        Dim wks         As Worksheet
    
        vData = ThisWorkbook.Worksheets("Ref").Range("ref_table").Value
        Set wks = ActiveSheet
        sName = wks.Parent.Name
    
        For n = LBound(vData) To UBound(vData)
            If InStr(sName, vData(n, 1)) Then
                With wks.Range(vData(n, 3))
                    .Value = vData(n, 2)
                    Application.Goto .Cells
                End With
                Exit For
            End If
        Next n
    End Sub
    Last edited by shg; 10-09-2012 at 10:36 AM.
    Entia non sunt multiplicanda sine necessitate

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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