Consulting

Results 1 to 3 of 3

Thread: ActiveCell.Text

  1. #1

    ActiveCell.Text

    I'm a beginner at vba so I don't know any of the specific syntax. My task at the moment is figuring the methods that go with ActiveCell. I found that typing ActiveCell.Value = 10 shows the number 10 in the cell but when I typr ActiveCell.Text = "Hello" I get an error saying object required.
    So far I only have three lines in the macro:

    Sub mymsgbox()

    ActiveCell.Text = "Hello"

    End Sub

    What constitutes an object in this situation?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    The text property of a range is a read-only string, it shows how the value looks not the actual value, so you cannot set that property.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    228
    Location
    Hi there,

    The code below will fill in text (defined value) in your active cell

    [vba]
    Sub mymsgbox()
    ActiveCell.FormulaR1C1 = "Hello"
    End Sub
    [/vba]

    Marshybid

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •