PDA

View Full Version : excel help



rjw29bs4
04-30-2018, 02:48 PM
i am trying to click on a unique number in 1 wookbook to open a reavent worksheet

Paul_Hossler
04-30-2018, 03:20 PM
i am trying to click on a unique number in 1 wookbook to open a reavent worksheet

OK

If there's a question or request in there, I'm afraid I missed it

rjw29bs4
04-30-2018, 04:28 PM
OK

If there's a question or request in there, I'm afraid I missed it
what i do i have a invoice wooksheet that has a invoice number 319525 for instance
and i save it under that
then when i do my accounts i list all my invoices numbers,date,cleint,and so on
what i won't do do is when i click on the invoice number in the account sheet it opens up the relavent worksheet
is this posable?

Paul_Hossler
04-30-2018, 06:00 PM
If you put this in the Invoices code sheet, double clicking in a invoice row will open the invoice number worksheet





Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim sInvoice As String
Dim x As Long

sInvoice = Target.EntireRow.Cells(1, 1).Value

If Len(sInvoice) = 0 Then Exit Sub

x = -1
On Error Resume Next
x = Worksheets(sInvoice).Index
On Error GoTo 0

If x = -1 Then
MsgBox sInvoice & " does not have invoice sheet"
Exit Sub
End If

Worksheets(sInvoice).Select
End Sub