osx - Runtime Error 13 on Mac but not PC -
thank helps me this.
i have written vba on pc, copywriters use mac , macros not work. run time error 13 on following code:
if range("home_epic_flag_count").value = 0
is gets highlighted yellow when debug
private sub worksheet_calculate() ' epic flag conditional testing macros if range("home_epic_flag_count").value = 0 me.shapes("home_epic_flag").visible = false else me.shapes("home_epic_flag").visible = true end if if range("rooms_epic_flag_count").value = 0 me.shapes("rooms_epic_flag").visible = false else me.shapes("rooms_epic_flag").visible = true end if if range("dining_epic_flag_count").value = 0 me.shapes("dining_epic_flag").visible = false else me.shapes("dining_epic_flag").visible = true end if if range("spa_epic_flag_count").value = 0 me.shapes("spa_epic_flag").visible = false else me.shapes("spa_epic_flag").visible = true end if if range("golf_epic_flag_count").value = 0 me.shapes("golf_epic_flag").visible = false else me.shapes("golf_epic_flag").visible = true end if if range("localarea_epic_flag_count").value = 0 me.shapes("localarea_epic_flag").visible = false else me.shapes("localarea_epic_flag").visible = true end if if range("business_epic_flag_count").value = 0 me.shapes("business_epic_flag").visible = false else me.shapes("business_epic_flag").visible = true end if
a little refactoring make code more manageable (once fix named range issue)
private sub worksheet_calculate() dim arr, x long arr = array("home", "rooms", "dining", "spa", "golf", "localarea", "business") x = lbound(arr) ubound(arr) me.shapes(arr(x) & "_epic_flag").visible = _ (range(arr(x) & "_epic_flag_count").value > 0) next x end sub
Comments
Post a Comment