Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 22 of 22

Thread: strAddress = .ActiveCell.Address Run-time error 438 when switching sheets

  1. #21
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    Have you declared "y" as anything?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  2. #22
    VBAX Regular
    Joined
    Apr 2017
    Posts
    63
    Location
    I don't know, it was someone else's proposed code change earlier on in the thread. Based on your question, it's doubtful. I don't know what the answer is as to specifically what it should be declared as.

    Top of sheet code
    Option Explicit
    
    Public arr As Variant
    Public strAddress As String
    Original code
    Public Sub ProcessTab()
    Dim i As Integer
    If Len(strAddress) <> 0 Then
        For i = 0 To UBound(arr)
            If arr(i) = Split(strAddress, ":")(0) Then
                If i = UBound(arr) Then
                    i = 0
                Else
                    i = i + 1
                End If
                Exit For
            End If
        Next
        ActiveSheet.Range(arr(i)).Select
    Else
        strAddress = arr(0)
    'End If
    'End Sub
    Suggested, amended to match original? Doesn't work.
    Public Sub ProcessTab()
    Dim y As Integer
        If strAddress <> "" Then
            y = Application.Match(Split(strAddress, ":")(0), arr, 0)
            Range(arr(y)).Select
        End If
    End Sub
    Last edited by MSXL; 09-07-2022 at 04:10 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •