ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filtering worksheet in VBA (https://www.excelbanter.com/excel-programming/372416-re-filtering-worksheet-vba.html)

RaY

Filtering worksheet in VBA
 
Thank you Dave, it works prefectly.

"Dave Peterson" wrote:

Check the name of the worksheet that owns the change:

Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

Select Case LCase(Sh.Name)
Case Is = "sheet1", "sheet2", "sheet3"
'do something
Case Is = "sheet5", "sheet4", "sheet6"
'do something else
Case Else
'do nothing or something else completely
End Select
End Sub




RaY wrote:

Hi,
I have got this situation. I made a macro that will be auto run after a
column has been updated. I am using Workbook_SheetChange in ThisWorkbook.
Since I need to update 12 sheets with that macro so that I put it in
there. The problem is.... the marco will be run in the other unnecessary
worksheet too.
Is there a method or way to return a value of the current worksheet and
let the code determine not to run that marco when that sheet is selected?

Regards,

Ray


--

Dave Peterson



All times are GMT +1. The time now is 07:10 AM.

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