worksheet

Refer to sheet using codename

你离开我真会死。 提交于 2019-11-26 03:31:01
问题 I get a \"type mismatch\" error in this code: With Worksheets(Sheet1) \'* Error here \'my code here End With My sheet\'s CodeName is \'sheet1\' . Can someone please help me remove the error? 回答1: 1) Refer to sheet by Index: With Worksheets(1) '<stuff here> End With The `Index' is dependent on the "order of sheets in the workbook". If you shuffle your sheets order, this may not refer to the same sheet any more! 2) Refer to sheet by Name: With Worksheets("Your Sheet Name") '<stuff here> End

VBA code doesn&#39;t run when cell is changed by a formula

无人久伴 提交于 2019-11-26 01:00:29
问题 Worksheet A has ranges of data that are collected from Worksheet B . Worksheet A has a macro that calculates if the data is above a value then calls an email module to email selected users. When the data is manually input on Worksheet A the Macro works, however when data is pulled from Worksheet B it doesn\'t fire. I\'m not sure what I need to change in my VBA code. Private Sub Worksheet_Change(ByVal Target As Range) Call MailAlert(Target, \"B5:M5\", 4) Call MailAlert(Target, \"B8:M8\", 7)

VBA code doesn&#39;t run when cell is changed by a formula

我怕爱的太早我们不能终老 提交于 2019-11-25 22:29:20
Worksheet A has ranges of data that are collected from Worksheet B . Worksheet A has a macro that calculates if the data is above a value then calls an email module to email selected users. When the data is manually input on Worksheet A the Macro works, however when data is pulled from Worksheet B it doesn't fire. I'm not sure what I need to change in my VBA code. Private Sub Worksheet_Change(ByVal Target As Range) Call MailAlert(Target, "B5:M5", 4) Call MailAlert(Target, "B8:M8", 7) Call MailAlert(Target, "B11:M11", 6) Call MailAlert(Target, "B14:M14", 2) Call MailAlert(Target, "B17:M17", 4)