![]() |
Checking if a cell has a range name
I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
Checking if a cell has a range name
One way: Sub dk() MsgBox ActiveCell.Name.Name End Sub "James Price at Premier" wrote in message ... I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
Checking if a cell has a range name
Or: Range("J10").Select ActiveCell.FormulaR1C1 = Range("Y1"),Value Range("J11").Select ActiveCell.FormulaR1C1 = Range("Y2").Value "JLGWhiz" wrote in message ... One way: Sub dk() MsgBox ActiveCell.Name.Name End Sub "James Price at Premier" wrote in message ... I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
Checking if a cell has a range name
Try: Sub WhatsInAName() On Error GoTo noname n = ActiveCell.Name MsgBox ("cell has a name") Exit Sub noname: MsgBox ("cell has no name") End Sub -- Gary''s Student - gsnu200858 "James Price at Premier" wrote: I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
Checking if a cell has a range name
Disregard second posting, wrong thread. "JLGWhiz" wrote in message ... Or: Range("J10").Select ActiveCell.FormulaR1C1 = Range("Y1"),Value Range("J11").Select ActiveCell.FormulaR1C1 = Range("Y2").Value "JLGWhiz" wrote in message ... One way: Sub dk() MsgBox ActiveCell.Name.Name End Sub "James Price at Premier" wrote in message ... I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
Checking if a cell has a range name
Hi, Try this. You don't need the message boxes, they're to illustrate it works On Error Resume Next dummy = ActiveCell.Name.Name If Len(dummy) = 0 Then MsgBox "activecell is not in named range" Else MsgBox ActiveCell.Name.Name End If Mike "James Price at Premier" wrote: I have a worksheet which has a number of Range names. Each named range relates to one cell only. There will be no instances of more than one range name in a cell. Can I use VBA to check if the Active Cell has a range name in it. Many thanks James |
All times are GMT +1. The time now is 02:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com