View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default working with 2 or vba's on the same sheet

Maybe...

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim s As String

'always fit the columns
Application.EnableEvents = False
Me.Cells.EntireColumn.AutoFit
Application.EnableEvents = True

If Intersect(Me.Range("A2"), Target) Is Nothing Then
'do nothing
Else
s = Me.Range("B2").Value
Me.Parent.FollowHyperlink Address:=s
End If
End Sub


But did you really want to check to see if the changed cell was A2, but follow
the link in B2????



confused deejay wrote:

so how would i write this work_sheet change on one sheet?

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("A2"), Target) Is Nothing Then
Exit Sub
End If
Dim s As String
s = Range("B2").Value
ActiveWorkbook.FollowHyperlink Address:=s
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Cells.EntireColumn.AutoFit
Application.EnableEvents = True
End Sub

sorry i'm very new to vba actually new to excel too only know what i know
through reading posts on here
--
deejay


--

Dave Peterson