ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   skip to worksheet (https://www.excelbanter.com/excel-programming/386365-skip-worksheet.html)

raraschek

skip to worksheet
 
I appreciate your help with this problem:
In A column I have a list of worksheets,
on double click on the cell I want to skip to proper worksheet. I have
something like this:
Private Sub Click()
Dim Wk As Worksheet
Dim WksName As String
For Each Wk In Worksheets
WksName = Range(A5).Value
Wk.Activate = Wk.Range("A5").Value

Next

End Sub

Vergel Adriano

skip to worksheet
 
Hi,

In the worksheet code module, something like this:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Column < 1 Then Exit Sub
Dim ws As Worksheet
On Error Resume Next
Set ws = Worksheets(Target.Value)
If Not ws Is Nothing Then ws.Activate
End Sub


--
Hope that helps.

Vergel Adriano


"raraschek" wrote:

I appreciate your help with this problem:
In A column I have a list of worksheets,
on double click on the cell I want to skip to proper worksheet. I have
something like this:
Private Sub Click()
Dim Wk As Worksheet
Dim WksName As String
For Each Wk In Worksheets
WksName = Range(A5).Value
Wk.Activate = Wk.Range("A5").Value

Next

End Sub



All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com