working with 2 or vba's on the same sheet
Since you can have only one worksheet change macro yo need to test the target
range to detrmine what actions the code should take.
A worksheet change can call another macro, but you need to have a worksheet
change on every sheet that you want it to work on. The macro can have just
three statements
Private Sub Worksheet_Change(ByVal Target As Range)
call common_code(target)
exit sub
"confused deejay" wrote:
hiya i have been reading up and following suggestions by other users however
this has meant that i am using more then one VBA on my worksheet. which
results in an error when system tries to activate the VBA error message
displays (ambigiuos name detected)
is there a way to get both or, more then one VBA with same name on a 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
also how do you put a VBA into a workbook/ excel so i don't have to copy
paste the same VBA on every page? again this will probably have more then one
VBA in it
--
deejay
|