G
Gerard Sanchez
Hi,
I was wondering if there's a way to make this code for the workbook itself
not the worksheet.
The code worked perfectly on the worksheet, but when I tried to copy it into
the workbook VBA, and change the word "Worksheet" into "Workbook," it didn't
work
From: Private Sub Worksheet_Change(ByVal Target As Range)
Into: Private Sub Workbook_Change(ByVal Target As Range)
The workbook I'm working on contains about 30 worksheets and having the VBA
code copied onto each worksheet has considerably slowed down the file.
I was thinking that it will be faster that the code resides on the workbook
and not the worksheet,
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Set myCell = Range("B36")
If Not Intersect(Target, myCell) Is Nothing Then
Range("E3").Activate
Dim myCell As Range
Set myCell = Range("E36")
If Not Intersect(Target, myCell) Is Nothing Then
Range("H3").Activate
Dim myCell As Range
Set myCell = Range("H34")
If Not Intersect(Target, myCell) Is Nothing Then
Range("B55").Activate
' . . . and on and on copied and pasted many times (its a large worsheet) ,
changing only the "myCell" address and "Activate" cell address '
End If
End Sub
I was wondering if there's a way to make this code for the workbook itself
not the worksheet.
The code worked perfectly on the worksheet, but when I tried to copy it into
the workbook VBA, and change the word "Worksheet" into "Workbook," it didn't
work
From: Private Sub Worksheet_Change(ByVal Target As Range)
Into: Private Sub Workbook_Change(ByVal Target As Range)
The workbook I'm working on contains about 30 worksheets and having the VBA
code copied onto each worksheet has considerably slowed down the file.
I was thinking that it will be faster that the code resides on the workbook
and not the worksheet,
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Set myCell = Range("B36")
If Not Intersect(Target, myCell) Is Nothing Then
Range("E3").Activate
Dim myCell As Range
Set myCell = Range("E36")
If Not Intersect(Target, myCell) Is Nothing Then
Range("H3").Activate
Dim myCell As Range
Set myCell = Range("H34")
If Not Intersect(Target, myCell) Is Nothing Then
Range("B55").Activate
' . . . and on and on copied and pasted many times (its a large worsheet) ,
changing only the "myCell" address and "Activate" cell address '
End If
End Sub