Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15795

"Reset" a With/End With structure?

$
0
0
I don't think it's possible to do, but I have code that has this structure.

Code:

Set ws = Activesheet
With ws
    For lngRow = 2 to 1000
        If lngRow = 100
            'Code to create a new worksheet which by default activates the new sheet
            'blah
            'blah
          Set ws = Activesheet ' The new sheet
          ' Is it possible here to have the With refer to the new sheet because as is the With
          ' still refers to the original sheet
        End If
        .Cells(lngRow, "A") = .Cells(lngRow, "A")
        End If
    Next
End With


Viewing all articles
Browse latest Browse all 15795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>