开发者

Excel, specify certain cell using Name field

开发者 https://www.devze.com 2023-01-05 23:43 出处:网络
I created a macro that doesn\'t allow values in both the B and C columns of an Excel sheet. I want to make an exception to that formula by allowing cells with the names DayShift or AfterShift.

I created a macro that doesn't allow values in both the B and C columns of an Excel sheet. I want to make an exception to that formula by allowing cells with the names DayShift or AfterShift.

I crea开发者_Python百科ted this:

If ActiveCell.Name = "DayShift" Or ActiveCell.Name = "AfterShift" Then

But it doesn't seem to work and just makes other cells error. Does anyone know how to do this correctly?


Try this:

If ActiveCell.Name.Name = "DayShift" Or ActiveCell.Name.Name = "AfterShift" Then
0

精彩评论

暂无评论...
验证码 换一张
取 消