![]() |
#2
|
||||
|
||||
![]()
There are a couple of tricks involved here. First is to avoid an error if the selection doesn't include any table elements. Second is to avoid having the end of cell marker as part of your string.
Code:
Sub Macro1() Dim str As String, aCell As Cell If Selection.Tables.Count > 0 Then str = Selection.Cells(1).Range.Text str = Left(str, Len(str) - 2) End If MsgBox "Text in first selected cell: " & str End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Move active cell down | Marcia | Excel Programming | 2 | 06-22-2022 04:10 PM |
![]() |
Peterson | Excel Programming | 3 | 03-07-2021 12:19 PM |
Cell equal value new value of active cell which is a drop down | hassanmoukadem | Excel Programming | 1 | 04-13-2020 07:54 PM |
Active cell not the one I select with curser. | hayesfam3 | Excel | 0 | 08-15-2019 05:14 AM |
![]() |
FUGMAN | Excel Programming | 7 | 02-05-2017 08:37 AM |