How do I get a range's address including the worksheet name, but not the workbook name, in Excel VBA?

前端 未结 11 1487
眼角桃花
眼角桃花 2020-12-25 10:34

If I have a Range object--for example, let\'s say it refers to cell A1 on a worksheet called Book1. So I know that calling Address()

11条回答
  •  抹茶落季
    2020-12-25 11:08

    Ben is right. I also can't think of any way to do this. I'd suggest either the method Ben recommends, or the following to strip the Workbook name off.

    Dim cell As Range
    Dim address As String
    Set cell = Worksheets(1).Cells.Range("A1")
    address = cell.address(External:=True)
    address = Right(address, Len(address) - InStr(1, address, "]"))
    

提交回复
热议问题