Consulting

Results 1 to 3 of 3

Thread: Solved: Programmatically naming an offset cell....

  1. #1

    Solved: Programmatically naming an offset cell....

    Olah guys!!

    I'm a bit rusty....I'm trying to create a simple sub I can attach to a button that names a cell 12 cells over using the active cell's text.

    Obviously, the following doesn't work but it explains what I'm trying to do.

    [vba]
    Sub NameCell()
    ActiveCell.Offset(0, 12).Names.Add Name:=ActiveCell.Text
    ActiveCell.Offset(1, 0).Select
    End Sub
    [/vba]

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Try
    With ActiveCell
        .Offset(0, 12).Name = .Text
    End With

  3. #3
    That worked. Boy do I feel sheepish.

    You rock my man.

    PS - Man I love these smilies. So....for everybody else and on a lighter, Sunday morning note:
    I'm sure the forum owners did lots of research collecting all of those cool little smilies. And, it's a pain in rear to organize them and load them into the modules. I'm sure they did that with intentions of people using them . Shame on you guys for not using them more often. I bit frustrating I'm sure for the owners.
    So I was thinking . I say from here on out, everybody should pledge to use at least one smilie per thread.
    Now, I'm not saying we just beat each other over the head with them for no reason. It should be there for a creative reason.
    Such as:
    Boy, this problem is a real p*sser:
    Or....
    You nucklehead....did you try Googling that first before bothering us? (I'm guilty of that one).
    If that was the case, you might even dig up a reason to save some of the really weird ones that are stuck at the bottom of the smilie list .(ok...that was a stretch)
    Because maybe....just maybe.....the extra thinking you have to do to actually use half of these d**m things in context will force you to think through the problem at hand. Or...if nothing else, it just might brighten up your day a little more.
    (at least that was the intention of this silly post.)

Posting Permissions

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