+ Reply to Thread
Results 1 to 3 of 3

Using variable names to select sheet names

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2007
    Posts
    88

    Unhappy Using variable names to select sheet names

    Im trying to select a sheet by using it's sheet index.

    i.e. selecting using Sheet1.select NOT by using sheets("Title").select

    I'm going to illustrate my problem by showing you my coding so far:

    Sub Test()
    Dim sheetcount As Integer
    Dim i As Integer
    
    sheetcount = ActiveWorkbook.Sheets.Count
    Application.ScreenUpdating = False
    
    
    If sheetcount = 20 Then
        Call Set_Screen_Properties
        For i = 1 To 20
            i = i + 1
            sheeti.Select
            Call Add_Hyperlink
            Selection.Name = ("Txt_1")
        Next
    End If
    Underlined is where the program crashes. Is there a way I can use the variable name to select the sheet via its index??

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526
    Maybe this....

    Sheets(i).Select

  3. #3
    Registered User
    Join Date
    02-12-2007
    Posts
    88
    Quote Originally Posted by davesexcel
    Maybe this....

    Sheets(i).Select
    Thanks you. That worked a treat

+ Reply to Thread

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