Results 1 to 6 of 6

Define a Workbook/WorkSheet Name by a String Value

Threaded View

bdb1974 Define a Workbook/WorkSheet... 10-19-2009, 05:59 PM
Richard Buttrey Re: Define a... 10-19-2009, 06:35 PM
bdb1974 Re: Define a... 10-20-2009, 12:11 PM
bdb1974 Re: Define a... 10-20-2009, 12:24 PM
shg Re: Define a... 10-20-2009, 12:25 PM
Richard Buttrey Re: Define a... 10-20-2009, 12:29 PM
  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Define a Workbook/WorkSheet Name by a String Value

    Hi all the following code will put the worksheet name "SomeName" into
    A1 to A10 on Sheet2.

    'ThisWorkbook.Names.Add Name:="SomeName", _
      '  RefersTo:=Worksheets("Sheet2").Range("A1:A10")
    I want to do the reverse. I want to use a string to define a Workbook name to activate. The workbook to be activated will be a variant in such the name
    will always be what the value of the string.

    Here's my attempt in which I'm getting a mismatch error:

    Dim stFileName1 As String 'or Variant or Double or something else?
    stFileName1 = Cells("O2").Value & "_" & "BOM.xls"
    
    With ThisWorkbook
      stAttachment = stPath & "\" & stFileName & ".xls"
    
    End With
    Workbooks(stFileName1).Activate
    
    
    
      With ActiveWorkbook.Sheets(stFileName)
    End With
    NE HLP is Greatly Appreciated.

    BDB
    Last edited by bdb1974; 10-20-2009 at 12:25 PM.

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